Modules

  • ABCDE
  • FGHIL
  • MNOPS
  • TUX

Tools

Perl functions by category

Perl 5 version 22.0 documentation
Recently read

Perl functions by category

Functions for SCALARs or strings

  • chomp - remove a trailing record separator from a string
  • chop - remove the last character from a string
  • chr - get character this number represents
  • crypt - one-way passwd-style encryption
  • hex - convert a string to a hexadecimal number
  • index - find a substring within a string
  • lc - return lower-case version of a string
  • lcfirst - return a string with just the next letter in lower case
  • length - return the number of bytes in a string
  • oct - convert a string to an octal number
  • ord - find a character's numeric representation
  • pack - convert a list into a binary representation
  • q/STRING/ - singly quote a string
  • qq/STRING/ - doubly quote a string
  • reverse - flip a string or a list
  • rindex - right-to-left substring search
  • sprintf - formatted print into a string
  • substr - get or alter a portion of a stirng
  • tr/// - transliterate a string
  • uc - return upper-case version of a string
  • ucfirst - return a string with just the next letter in upper case
  • y/// - transliterate a string

Regular expressions and pattern matching

  • m// - match a string with a regular expression pattern
  • pos - find or set the offset for the last/next m//g search
  • qr/STRING/ - Compile pattern
  • quotemeta - quote regular expression magic characters
  • s/// - replace a pattern with a string
  • split - split up a string using a regexp delimiter
  • study - optimize input data for repeated searches

Numeric functions

  • abs - absolute value function
  • atan2 - arctangent of Y/X in the range -PI to PI
  • cos - cosine function
  • exp - raise I to a power
  • hex - convert a string to a hexadecimal number
  • int - get the integer portion of a number
  • log - retrieve the natural logarithm for a number
  • oct - convert a string to an octal number
  • rand - retrieve the next pseudorandom number
  • sin - return the sine of a number
  • sqrt - square root function
  • srand - seed the random number generator

Functions for real @ARRAYs

  • pop - remove the last element from an array and return it
  • push - append one or more elements to an array
  • shift - remove the first element of an array, and return it
  • splice - add or remove elements anywhere in an array
  • unshift - prepend more elements to the beginning of a list

Functions for list data

  • grep - locate elements in a list test true against a given criterion
  • join - join a list into a string using a separator
  • map - apply a change to a list to get back a new list with the changes
  • qw/STRING/ - quote a list of words
  • reverse - flip a string or a list
  • sort - sort a list of values
  • unpack - convert binary structure into normal perl variables

Functions for real %HASHes

  • delete - deletes a value from a hash
  • each - retrieve the next key/value pair from a hash
  • exists - test whether a hash key is present
  • keys - retrieve list of indices from a hash
  • values - return a list of the values in a hash

Input and output functions

  • binmode - prepare binary files for I/O
  • close - close file (or pipe or socket) handle
  • closedir - close directory handle
  • dbmclose - breaks binding on a tied dbm file
  • dbmopen - create binding on a tied dbm file
  • die - raise an exception or bail out
  • eof - test a filehandle for its end
  • fileno - return file descriptor from filehandle
  • flock - lock an entire file with an advisory lock
  • format - declare a picture format with use by the write() function
  • getc - get the next character from the filehandle
  • print - output a list to a filehandle
  • printf - output a formatted list to a filehandle
  • read - fixed-length buffered input from a filehandle
  • readdir - get a directory from a directory handle
  • readline - fetch a record from a file
  • rewinddir - reset directory handle
  • seek - reposition file pointer for random-access I/O
  • seekdir - reposition directory pointer
  • select - reset default output or do I/O multiplexing
  • syscall - execute an arbitrary system call
  • sysread - fixed-length unbuffered input from a filehandle
  • sysseek - position I/O pointer on handle used with sysread and syswrite
  • syswrite - fixed-length unbuffered output to a filehandle
  • tell - get current seekpointer on a filehandle
  • telldir - get current seekpointer on a directory handle
  • truncate - shorten a file
  • warn - print debugging info
  • write - print a picture record

Functions for fixed length data or records

  • pack - convert a list into a binary representation
  • read - fixed-length buffered input from a filehandle
  • syscall - execute an arbitrary system call
  • sysread - fixed-length unbuffered input from a filehandle
  • sysseek - position I/O pointer on handle used with sysread and syswrite
  • syswrite - fixed-length unbuffered output to a filehandle
  • unpack - convert binary structure into normal perl variables
  • vec - test or set particular bits in a string

Functions for filehandles, files, or directories

  • -X - a file test (-r, -x, etc)
  • chdir - change your current working directory
  • chmod - changes the permissions on a list of files
  • chown - change the owership on a list of files
  • chroot - make directory new root for path lookups
  • fcntl - file control system call
  • glob - expand filenames using wildcards
  • ioctl - system-dependent device control system call
  • link - create a hard link in the filesytem
  • lstat - stat a symbolic link
  • mkdir - create a directory
  • open - open a file, pipe, or descriptor
  • opendir - open a directory
  • readlink - determine where a symbolic link is pointing
  • rename - change a filename
  • rmdir - remove a directory
  • stat - get a file's status information
  • symlink - create a symbolic link to a file
  • sysopen - open a file, pipe, or descriptor
  • umask - set file creation mode mask
  • unlink - remove one link to a file
  • utime - set a file's last access and modify times

Keywords related to control flow of your perl program

  • caller - get context of the current subroutine call
  • continue - optional trailing block in a while or foreach
  • die - raise an exception or bail out
  • do - turn a BLOCK into a TERM
  • dump - create an immediate core dump
  • eval - catch exceptions or compile and run code
  • exit - terminate this program
  • goto - create spaghetti code
  • last - exit a block prematurely
  • next - iterate a block prematurely
  • prototype - get the prototype (if any) of a subroutine
  • redo - start this loop iteration over again
  • return - get out of a function early
  • sub - declare a subroutine, possibly anonymously
  • wantarray - get void vs scalar vs list context of current subroutine call

Keywords altering or affecting scoping of identifiers

  • caller - get context of the current subroutine call
  • import - patch a module's namespace into your own
  • local - create a temporary value for a global variable (dynamic scoping)
  • my - declare and assign a local variable (lexical scoping)
  • our - declare and assign a package variable (lexical scoping)
  • package - declare a separate global namespace
  • use - load in a module at compile time

Miscellaneous functions

  • defined - test whether a value, variable, or function is defined
  • dump - create an immediate core dump
  • eval - catch exceptions or compile and run code
  • formline - internal function used for formats
  • local - create a temporary value for a global variable (dynamic scoping)
  • my - declare and assign a local variable (lexical scoping)
  • our - declare and assign a package variable (lexical scoping)
  • prototype - get the prototype (if any) of a subroutine
  • reset - clear all variables of a given name
  • scalar - force a scalar context
  • undef - remove a variable or function definition
  • wantarray - get void vs scalar vs list context of current subroutine call

Functions for processes and process groups

  • alarm - schedule a SIGALRM
  • exec - abandon this program to run another
  • fork - create a new process just like this one
  • getpgrp - get process group
  • getppid - get parent process ID
  • getpriority - get current nice value
  • kill - send a signal to a process or process group
  • pipe - open a pair of connected filehandles
  • qx/STRING/ - backquote quote a string
  • readpipe - execute a system command and collect standard output
  • setpgrp - set the process group of a process
  • setpriority - set a process's nice value
  • sleep - block for some number of seconds
  • system - run a separate program
  • times - return elapsed time for self and child processes
  • wait - wait for any child process to die
  • waitpid - wait for a particular child process to die

Keywords related to perl modules

  • do - turn a BLOCK into a TERM
  • import - patch a module's namespace into your own
  • no - unimport some module symbols or semantics at compile time
  • package - declare a separate global namespace
  • require - load in external functions from a library at runtime
  • use - load in a module at compile time

Keywords related to classes and object-orientedness

  • bless - create an object
  • dbmclose - breaks binding on a tied dbm file
  • dbmopen - create binding on a tied dbm file
  • package - declare a separate global namespace
  • ref - find out the type of thing being referenced
  • tie - bind a variable to an object class
  • tied - get a reference to the object underlying a tied variable
  • untie - break a tie binding to a variable
  • use - load in a module at compile time

Low-level socket functions

  • accept - accept an incoming socket connect
  • bind - binds an address to a socket
  • connect - connect to a remote socket
  • getpeername - find the other end of a socket connection
  • getsockname - retrieve the sockaddr for a given socket
  • getsockopt - get socket options on a given socket
  • listen - register your socket as a server
  • recv - receive a message over a Socket
  • send - send a message over a socket
  • setsockopt - set some socket options
  • shutdown - close down just half of a socket connection
  • socket - create a socket
  • socketpair - create a pair of sockets

System V interprocess communication functions

  • msgctl - SysV IPC message control operations
  • msgget - get SysV IPC message queue
  • msgrcv - receive a SysV IPC message from a message queue
  • msgsnd - send a SysV IPC message to a message queue
  • semctl - SysV semaphore control operations
  • semget - get set of SysV semaphores
  • semop - SysV semaphore operations
  • shmctl - SysV shared memory operations
  • shmget - get SysV shared memory segment identifier
  • shmread - read SysV shared memory
  • shmwrite - write SysV shared memory

Fetching user and group info

Fetching network info

Time-related functions

  • gmtime - convert UNIX time into record or string using Greenwich time
  • localtime - convert UNIX time into record or string using local time
  • time - return number of seconds since 1970
  • times - return elapsed time for self and child processes