Wednesday, January 19, 2011

perl function

For specific information on a function, use perldoc -f function_name to get a concise summary.

absabsolute value
chdirchange current directory
chmodchange permissions of file/directory
chompremove terminal newline from string variable
chopremove last character from string variable
chownchange ownership of file/directory
closeclose a file handle
closedirclose a directory handle
coscosine
definedtest whether variable is defined
deletedelete a key from a hash
dieexit with an error message
eachiterate through keys & values of a hash
eoftest a filehandle for end of file
evalevaluate a string as a perl expression
execquit Perl and execute a system command
existstest that a hash key exists
exitexit from the Perl script
globexpand a directory listing using shell wildcards
gmtimecurrent time in GMT
grepfilter an array for entries that meet a criterion
indexfind location of a substring inside a larger string
intthrow away the fractional part of a floating point number
joinjoin an array together into a string
keysreturn the keys of a hash
killsend a signal to one or more processes
lastexit enclosing loop
lcconvert string to lowercase
lcfirstlowercase first character of string
lengthfind length of string
localtemporarily replace the value of a global variable
localtimereturn time in local timezone
lognatural logarithm
m//pattern match operation
mapperform on operation on each member of array or list
mkdirmake a new directory
mycreate a local variable
nextjump to the top of enclosing loop
openopen a file for reading or writing
opendiropen a directory for listing
packpack a list into a compact binary representation
packagecreate a new namespace for a module
poppop the last item off the end of an array
printprint to terminal or a file
printfformatted print to a terminal or file
pushpush a value onto the end of an array
q/STRING/generalized single-quote operation
qq/STRING/generalized double-quote operation
qx/STRING/generalized backtick operation
qw/STRING/turn a space-delimited string of words into a list
randrandom number generator
readread binary data from a file
readdirread the contents of a directory
readlineread a line from a text file
readlinkdetermine the target of a symbolic link
redorestart a loop from the top
refreturn the type of a variable reference
renamerename or move a file
requireload functions defined in a library file
returnreturn a value from a user-defined subroutine
reversereverse a string or list
rewinddirrewind a directory handle to the beginning
rindexfind a substring in a larger string, from right to left
rmdirremove a directory
s///pattern substitution operation
scalarforce an expression to be treated as a scalar
seekreposition a filehandle to an arbitrary point in a file
selectmake a filehandle the default for output
shiftshift a value off the beginning of an array
sinsine
sleepput the script to sleep for a while
sortsort an array or list by user-specified criteria
spliceinsert/delete array items
splitsplit a string into pieces according to a pattern
sprintfformatted string creation
sqrtsquare root
statget information about a file
subdefine a subroutine
substrextract a substring from a string
symlinkcreate a symbolic link
systemexecute an operating system command, then return to Perl
tellreturn the position of a filehandle within a file
tieassociate a variable with a database
timereturn number of seconds since January 1, 1970
tr///replace characters in a string
truncatetruncate a file (make it smaller)
ucuppercase a string
ucfirstuppercase first character of a string
umaskchange file creation mask
undefundefine (remove) a variable
unlinkdelete a file
unpackthe reverse of pack
untiethe reverse of tie
unshiftmove a value onto the beginning of an array
useimport variables and functions from a library module
valuesreturn the values of a hash variable
wantarrayreturn true in an array context
warnprint a warning to standard error
writeformatted report generation


 

No comments: