Full documentation of builtin functions: perlfunc
Here are Perl's functions (including things that look like functions, like some keywords and named operators) arranged by category. Some functions appear in more than one place. Any warnings, including those produced by keywords, are described in perldiag and warnings.
chomp
, chop
, chr
, crypt
, fc
, hex
, index
, lc
, lcfirst
, length
, oct
, ord
, pack
, q//
, qq//
, reverse
, rindex
, sprintf
, substr
, tr///
, uc
, ucfirst
, y///
fc
is available only if the "fc"
feature is enabled or if it is prefixed with CORE::
. The "fc"
feature is enabled automatically with a use v5.16
(or higher) declaration in the current scope.
abs
, atan2
, cos
, exp
, hex
, int
, log
, oct
, rand
, sin
, sqrt
, srand
binmode
, close
, closedir
, dbmclose
, dbmopen
, die
, eof
, fileno
, flock
, format
, getc
, print
, printf
, read
, readdir
, readline
, rewinddir
, say
, seek
, seekdir
, select
, syscall
, sysread
, sysseek
, syswrite
, tell
, telldir
, truncate
, warn
, write
say
is available only if the "say"
feature is enabled or if it is prefixed with CORE::
. The "say"
feature is enabled automatically with a use v5.10
(or higher) declaration in the current scope.
pack
, read
, syscall
, sysread
, sysseek
, syswrite
, unpack
, vec
-X
, chdir
, chmod
, chown
, chroot
, fcntl
, glob
, ioctl
, link
, lstat
, mkdir
, open
, opendir
, readlink
, rename
, rmdir
, select
, stat
, symlink
, sysopen
, umask
, unlink
, utime
break
, caller
, continue
, die
, do
, dump
, eval
, evalbytes
, exit
, __FILE__
, goto
, last
, __LINE__
, method
, next
, __PACKAGE__
, redo
, return
, sub
, __SUB__
, wantarray
break
is available only if you enable the experimental "switch"
feature or use the CORE::
prefix. The "switch"
feature also enables the default
, given
and when
statements, which are documented in "Switch Statements" in perlsyn. The "switch"
feature is enabled automatically with a use v5.10
(or higher) declaration in the current scope. In Perl v5.14 and earlier, continue
required the "switch"
feature, like the other keywords.
evalbytes
is only available with the "evalbytes"
feature (see feature) or if prefixed with CORE::
. __SUB__
is only available with the "current_sub"
feature or if prefixed with CORE::
. Both the "evalbytes"
and "current_sub"
features are enabled automatically with a use v5.16
(or higher) declaration in the current scope.
caller
, class
, field
, import
, local
, my
, our
, package
, state
, use
state
is available only if the "state"
feature is enabled or if it is prefixed with CORE::
. The "state"
feature is enabled automatically with a use v5.10
(or higher) declaration in the current scope.
alarm
, exec
, fork
, getpgrp
, getppid
, getpriority
, kill
, pipe
, qx//
, readpipe
, setpgrp
, setpriority
, sleep
, system
, times
, wait
, waitpid
bless
, class
, __CLASS__
, dbmclose
, dbmopen
, field
, method
, package
, ref
, tie
, tied
, untie
, use
accept
, bind
, connect
, getpeername
, getsockname
, getsockopt
, listen
, recv
, send
, setsockopt
, shutdown
, socket
, socketpair
msgctl
, msgget
, msgrcv
, msgsnd
, semctl
, semget
, semop
, shmctl
, shmget
, shmread
, shmwrite
endgrent
, endhostent
, endnetent
, endpwent
, getgrent
, getgrgid
, getgrnam
, getlogin
, getpwent
, getpwnam
, getpwuid
, setgrent
, setpwent
endprotoent
, endservent
, gethostbyaddr
, gethostbyname
, gethostent
, getnetbyaddr
, getnetbyname
, getnetent
, getprotobyname
, getprotobynumber
, getprotoent
, getservbyname
, getservbyport
, getservent
, sethostent
, setnetent
, setprotoent
, setservent
ADJUST
, and
, AUTOLOAD
, BEGIN
, catch
, CHECK
, cmp
, CORE
, __DATA__
, default
, defer
, DESTROY
, else
, elseif
, elsif
, END
, __END__
, eq
, finally
, for
, foreach
, ge
, given
, gt
, if
, INIT
, isa
, le
, lt
, ne
, not
, or
, try
, UNITCHECK
, unless
, until
, when
, while
, x
, xor
-X
- a file test (-r, -x, etc)
__CLASS__
- the class name of the current instance.
__FILE__
- the name of the current source file
__LINE__
- the current source line number
__PACKAGE__
- the current package
__SUB__
- the current subroutine, or undef
if not in a subroutine
abs
- absolute value function
accept
- accept an incoming socket connect
alarm
- schedule a SIGALRM
all
- test if every value in a list satisfies the given condition
any
- test if at least one value in a list satisfies the given condition
atan2
- arctangent of Y/X in the range -PI to PI
bind
- binds an address to a socket
binmode
- prepare binary files for I/O
bless
- create an object
caller
- get context of the current subroutine call
chdir
- change your current working directory
chmod
- changes the permissions on a list of files
chomp
- remove a trailing record separator from a string
chop
- remove the last character from a string
chown
- change the ownership on a list of files
chr
- get character this number represents
chroot
- make directory new root for path lookups
class
- declare a separate global namespace that is an object class
close
- close file (or pipe or socket) handle
closedir
- close directory handle
connect
- connect to a remote socket
continue
- optional trailing block in a while or foreach
cos
- cosine function
crypt
- one-way passwd-style encryption
dbmclose
- breaks binding on a tied dbm file
dbmopen
- create binding on a tied dbm file
defined
- test whether a value, variable, or function is defined
delete
- deletes a value from a hash
die
- raise an exception or bail out
do
- turn a BLOCK into a TERM
dump
- create an immediate core dump
each
- retrieve the next key/value pair from a hash
endgrent
- be done using group file
endhostent
- be done using hosts file
endnetent
- be done using networks file
endprotoent
- be done using protocols file
endpwent
- be done using passwd file
endservent
- be done using services file
eof
- test a filehandle for its end
eval
- catch exceptions or compile and run code
evalbytes
- similar to string eval, but intend to parse a bytestream
exec
- abandon this program to run another
exists
- test whether a hash key is present
exit
- terminate this program
exp
- raise e to a power
fc
- return casefolded version of a string
fcntl
- file control system call
field
- declare a field variable of the current class
fileno
- return file descriptor from filehandle
flock
- lock an entire file with an advisory lock
fork
- create a new process just like this one
format
- declare a picture format with use by the write() function
formline
- internal function used for formats
getc
- get the next character from the filehandle
getgrent
- get next group record
getgrgid
- get group record given group user ID
getgrnam
- get group record given group name
gethostbyaddr
- get host record given its address
gethostbyname
- get host record given name
gethostent
- get next hosts record
getlogin
- return who logged in at this tty
getnetbyaddr
- get network record given its address
getnetbyname
- get networks record given name
getnetent
- get next networks record
getpeername
- find the other end of a socket connection
getpgrp
- get process group
getppid
- get parent process ID
getpriority
- get current nice value
getprotobyname
- get protocol record given name
getprotobynumber
- get protocol record numeric protocol
getprotoent
- get next protocols record
getpwent
- get next passwd record
getpwnam
- get passwd record given user login name
getpwuid
- get passwd record given user ID
getservbyname
- get services record given its name
getservbyport
- get services record given numeric port
getservent
- get next services record
getsockname
- retrieve the sockaddr for a given socket
getsockopt
- get socket options on a given socket
glob
- expand filenames using wildcards
gmtime
- convert UNIX time into record or string using Greenwich time
goto
- create spaghetti code
grep
- locate elements in a list test true against a given criterion
hex
- convert a hexadecimal string to a number
import
- patch a module's namespace into your own
index
- find a substring within a string
int
- get the integer portion of a number
ioctl
- system-dependent device control system call
join
- join a list into a string using a separator
keys
- retrieve list of indices from a hash