You can always use a {BLOCK} returning the right type of reference instead of the variable identifier, e.g., ${...}, &{...}. $$p is just a shorthand for ${$p}.

Operators

**

Exponentiation

+ -

* /

Addition, subtraction, multiplication, division

%

Modulo division

& |

^

Bitwise AND, bitwise OR, bitwise exclusive OR

>>

<<

Bitwise shift right, bitwise shift left

||

&&

Logical OR, logical AND

.

Concatenation of two strings

x

Returns a string or array consisting of the left operand (an array or a string) repeated the number of times specified by the right operand

All of the above operators also have an assignment operator, e.g., .=

->

Dereference operator

\

Reference (unary)

!

~

Negation (unary), bitwise complement (unary)

++

--

Auto-increment (magical on strings), auto-decrement

==

!=

Numeric equality, inequality

eq

ne

String equality, inequality

<

>

Numeric less than, greater than

lt

gt

String less than, greater than

<=

>=

Numeric less (greater) than or equal to

le

ge

String less (greater) than or equal to

<=>

cmp

Numeric (string) compare. Returns -1, 0, 1.

=~

!~

Search pattern, substitution, or translation (negated)

..

Range (scalar context) or enumeration (array context)

?:

Alternation (if-then-else) operator

,

Comma operator, also list element separator. You can also use =>.

not

Low-precedence negation

and

Low-precedence AND

or

xor

Low-precedence OR, exclusive OR

All Perl functions can be used as list operators, in which case they have very high or very low precedence, depending on whether you look at the left or the right side of the operator. Only the operators not, and, or and xor have lower precedence.

A "list" is a list of expressions, variables, or lists. An array variable or an array slice may always be used instead of a list.

Parentheses can be added around the parameter lists to avoid precedence problems.

Statements

Every statement is an expression, optionally followed by a modifier, and terminated by a semicolon. The semicolon may be omitted if the statement is the final one in a BLOCK.

Execution of expressions can depend on other expressions using one of the modifiers if, unless, while or until, for example:

EXPR1

if

EXPR2

;

EXPR1

until

EXPR2

;

The logical operators ||, && or ?: also allow conditional execution:

EXPR1

||

EXPR2

;

EXPR1

?

EXPR2

:

EXPR3

;

Statements can be combined to form a BLOCK when enclosed in {}. Blocks may be used to control flow:

if(

EXPR

)

BLOCK [ [

elsif(

EXPR

)

BLOCK ... ]

else

BLOCK ]

unless(

EXPR

)

BLOCK [

else

BLOCK ]

[ LABEL

:

]

while

(EXPR) BLOCK [

continue

BLOCK ]

[ LABEL

:

]

until

(EXPR) BLOCK [

continue

BLOCK ]

[ LABEL

:

]

for

(EXPR

;

EXPR

;

EXPR) BLOCK

[ LABEL

:

]

foreach

VAR† (LIST) BLOCK

[ LABEL

:

] BLOCK [

continue

BLOCK ]

Program flow can be controlled with:

goto LABEL

Continue execution at the specified label.

last [ LABEL ]

Immediately exits the loop in question. Skips continue block.

next [ LABEL ]

Starts the next iteration of the loop.

redo [ LABEL ]

Restarts the loop block without evaluating the conditional again.

Special forms are:

do

BLOCK

while

EXPR

;do

BLOCK

until

EXPR

;

which are guaranteed to perform BLOCK once before testing EXPR, and

do

BLOCK

which effectively turns BLOCK into an expression.

Subroutines, Packages and Modules

&SUBROUTINE LIST

Executes a SUBROUTINE declared by a sub declaration, and returns the value of the last expression evaluated in SUBROUTINE. SUBROUTINE can be an expression yielding a reference to a code object. The & may be omitted if the subroutine has been declared before being used.

bless REF [ , PACKAGE ]

Turns the object REF into an object in PACKAGE. Returns the reference.

caller [ EXPR ]

Returns an array ($package,$file,$line,...) for a specific subroutine call. caller returns this info for the current subroutine, caller(1) for the caller of this subroutine, etc. Returns false if no caller.

do SUBROUTINE LIST

Deprecated form of &SUBROUTINE.

goto&SUBROUTINE

Substitutes a call to SUBROUTINE for the current subroutine.

import MODULE [ [ VERSION ] LIST ]

Imports the named subroutines from MODULE.

no MODULE [ LIST ]

Cancels imported semantics. See use.

package NAME

Designates the remainder of the current block as a package.

require EXPR†

If EXPR is numeric, requires Perl to be at least that version. Otherwise EXPR must be the name of a file that is included from the Perl library. Does not include more than once, and yields a fatal error if the file does not evaluate to a true value. If EXPR is a bare word, assumes extension .pm for the name of the file.

return EXPR

Returns from a subroutine with the value specified.

sub NAME { EXPR ; ... }

Designates NAME as a subroutine. Parameters are passed by reference as array @_. Returns the value of the last expression evaluated.

[ sub ] BEGIN{ EXPR ; ... }

Defines a setup BLOCK to be called before execution.

[ sub ] END{ EXPR ; ... }

Defines a cleanup BLOCK to be called upon termination.

tie VAR, PACKAGE, [ LIST ]

Ties a variable to a package that will handle it. Can be used to bind a dbm or ndbm file to a hash.

untie VAR

Breaks the binding between the variable and the package.

use MODULE [ [ VERSION ] LIST ]

Imports semantics from the named module into the current package.

Object-Oriented Programming

Perl rules of object oriented programming:

An object is simply a reference that happens to know which class it belongs to. Objects are blessed, references are not.

A class is simply a package that happens to provide methods to deal with object references. If a package fails to provide a method, the base classes as listed in @ISA are searched.

A method is simply a subroutine that expects an object reference (or a package name, for static methods) as the first argument.

Methods can be applied with:

METHOD OBJREF PARAMETERS or

OBJREF

->

METHOD PARAMETERS

Arithmetic Functions

abs EXPR†

Returns the absolute value of its operand.

atan2 Y,X

Returns the arctangent of Y/X in the range -pi to pi.

cos EXPR†

Returns the cosine of EXPR (expressed in radians).

exp EXPR†

Returns e to the power of EXPR.

int EXPR†

Returns the integer portion of EXPR.

log EXPR†

Returns natural logarithm (base e) of EXPR.

rand [ EXPR ]

Returns a random fractional number between 0 and the value of EXPR. If EXPR is omitted, returns a value between 0 and 1.

sin EXPR†

Returns the sine of EXPR (expressed in radians).

sqrt EXPR†

Returns the square root of EXPR.

srand [ EXPR ]

Sets the random number seed for the rand operator.

time

Returns the number of seconds since January 1, 1970. Suitable for feeding to gmtime and localtime.

Conversion Functions

chr EXPR†

Returns the character represented by the decimal value EXPR.

gmtime EXPR†

Converts a time as returned by the time function to a 9-element array (0: $sec, 1: $min, 2: $hour, 3: $mday, 4: $mon, 5: $year, 6: $wday, 7: $yday, 8: $isdst) with the time analyzed for the Greenwich time zone. $mon has the range 0..11 and $wday has the range 0..6.

hex EXPR†

Returns the decimal value of EXPR interpreted as a hex string.

localtime EXPR†

Converts a time as returned by the time function to ctime(3) string. In array context, returns a 9-element array with the time analyzed for the local time zone.

oct EXPR†

Returns the decimal value of EXPR interpreted as an octal string. If EXPR starts off with 0x, interprets it as a hex string instead.

ord EXPR†

Returns the ASCII value of the first character of EXPR.

vec EXPR, OFFSET, BITS

Treats string EXPR as a vector of unsigned integers, and yields the bit at OFFSET. BITS must be between 1 and 32. May be assigned to.

Structure Conversion

pack TEMPLATE, LIST

Packs the values into a binary structure using TEMPLATE.

unpack TEMPLATE, EXPR

Unpacks the structure EXPR into an array, using TEMPLATE.

TEMPLATE is a sequence of characters as follows:

a / A

ASCII string, null- / space-padded

b / B

Bit string in ascending / descending order

c / C

Native / unsigned char value

f / d

Single / double float in native format

h / H

Hex string, low / high nybble first

i / I

Signed / unsigned integer value

l / L

Signed / unsigned long value

n / N

Short / long in network (big endian) byte order

s / S

Signed / unsigned short value

u / P

Uuencoded string / pointer to a string

v / V

Short / long in VAX (little endian) byte order

x / @

Null byte / null fill until position

X

Backup a byte

Each character may be followed by a decimal number that will be used as a repeat count; an asterisk (*) specifies all remaining arguments. If the format is preceded with %N, unpack returns an N-bit checksum instead. Spaces may be included in the template for readability purposes.

String Functions

chomp LIST†

Removes line endings from all elements of the list; returns the (total) number of characters removed.

chop LIST†

Chops off the last character on all elements of the list; returns the last chopped character.

crypt PLAINTEXT, SALT

Encrypts a string.

eval EXPR†

EXPR is parsed and executed as if it were a Perl program. The value returned is the value of the last expression evaluated. If there is a syntax error or runtime error, an undefined string is returned by eval, and $@ is set to the error message. See also eval in section Miscellaneous.

index STR, SUBSTR [ , OFFSET ]

Returns the position of SUBSTR in STR at or after OFFSET. If the substring is not found, returns -1 (but see $[ in section Special Variables).

length EXPR†

Returns the length in characters of the value of EXPR.

lc EXPR

Returns a lowercase version of EXPR.

lcfirst EXPR

Returns EXPR with the first character lowercase.

quotemeta EXPR

Returns EXPR with all regular expression metacharacters quoted.

rindex STR, SUBSTR [ , OFFSET ]

Returns the position of the last SUBSTR in STR at or before OFFSET.

substr EXPR, OFFSET [ , LEN ]

Extracts a substring of length LEN out of EXPR and returns it. If OFFSET is negative, counts from the end of the string. May be assigned to.

uc EXPR

Returns an uppercased version of EXPR.

ucfirst EXPR

Returns EXPR with the first character uppercased.

Array and List Functions

delete$HASH{KEY}

Deletes the specified value from the specified hash. Returns the deleted value unless HASH is tied to a package that does not support this.

each%HASH

Returns a 2-element array consisting of the key and value for the next value of the hash. Entries are returned in an apparently random order. After all values of the hash have been returned, a null array is returned. The next call to each after that will start iterating again.

exists EXPR†

Checks if the specified hash key exists in its hash array.

grep EXPR, LIST grep BLOCK LIST

Evaluates EXPR or BLOCK for each element of the LIST, locally setting $_ to refer to the element. Modifying $_ will modify the corresponding element from LIST. Returns the array of elements from LIST for which EXPR returned true.

join EXPR, LIST

Joins the separate strings of LIST into a single string with fields separated by the value of EXPR, and returns the string.

keys%HASH

Returns an array with all of the keys of the named hash.

map EXPR, LIST map BLOCK LIST

Evaluates EXPR or BLOCK for each element of the LIST, locally setting $_ to refer to the element. Modifying $_ will modify the corresponding element from LIST. Returns the list of results.

pop@ARRAY

Pops off and returns the last value of the array.

push@ARRAY, LIST

Pushes the values of LIST onto the end of the array.

reverse LIST

In array context, returns the LIST in reverse order. In scalar context: returns the first element of LIST with bytes reversed.

scalar@ARRAY

Returns the number of elements in the array.

scalar%HASH

Returns a true value if the hash has elements defined.

shift [ @ARRAY ]

Shifts the first value of the array off and returns it, shortening the array by 1 and moving everything down. If @ARRAY is omitted, shifts @ARGV in main and @_ in subroutines.

sort [ SUBROUTINE ] LIST

Sorts the LIST and returns the sorted array value. SUBROUTINE, if specified, must return less than zero, zero, or greater than zero, depending on how the elements of the array (available to the routine as $a and $b) are to be ordered. SUBROUTINE may be the name of a user-defined routine, or a BLOCK.

splice@ARRAY, OFFSET [ , LENGTH [ , LIST ] ]

Removes the elements of @ARRAY designated by OFFSET and LENGTH, and replaces them with LIST (if specified). Returns the elements removed.

split [ PATTERN [ , EXPR† [ , LIMIT ] ] ]

Splits a string into an array of strings, and returns it. If LIMIT is specified, splits into at most that number of fields. If PATTERN is also omitted, splits at the whitespace. If not in array context, returns number of fields and splits to @_. See also Search and Replace Functions.

unshift@ARRAY, LIST

Prepends list to the front of the array, and returns the number of elements in the new array.

values%HASH

Returns a normal array consisting of all the values of the named hash.

Regular Expressions

Each character matches itself, unless it is one of the special characters + ? . * ^ $ ( ) [ ] { } | \. The special meaning of these characters can be escaped using a \.

.

matches an arbitrary character, but not a newline unless it is a single-line match (see m//s).

(...)

groups a series of pattern elements to a single element.

^

matches the beginning of the target. In multiline mode (see m//m) also matches after every newline character.

$

matches the end of the line. In multiline mode also matches before every newline character.

[ ... ]

denotes a class of characters to match. [^ ... ] negates the class.

( ... | ... | ... )

matches one of the alternatives.

(?# TEXT )

Comment.

(?: REGEXP )

Like (REGEXP) but does not make back-references.

(?= REGEXP )

Zero width positive look-ahead assertion.

(?! REGEXP )

Zero width negative look-ahead assertion.

(? MODIFIER )

Embedded pattern-match modifier. MODIFIER can be one or more of i, m, s, or x.

Quantified subpatterns match as many times as possible. When followed with a ? they match the minimum number of times. These are the quantifiers:

With modifier x, whitespace can be used in the patterns for readability purposes.

Search and Replace Functions

[ EXPR =~ ] [ m ] /PATTERN/ [ g ] [ i ] [ m ] [ o ] [ s ] [ x ]

Searches EXPR (default: $_) for a pattern. If you prepend an m you can use almost any pair of delimiters instead of the slashes. If used in array context, an array is returned consisting of the subexpressions matched by the parentheses in the pattern, i.e., ($1,$2,$3,...). Optional modifiers: g matches as many times as possible; i searches in a case-insensitive manner; o interpolates variables only once. m treats the string as multiple lines; s treats the string as a single line; x allows for regular expression extensions. If PATTERN is empty, the most recent pattern from a previous match or replacement is used. With g the match can be used as an iterator in scalar context.

?PATTERN?

This is just like the /PATTERN/ search, except that it matches only once between calls to the reset operator.

Searches a string for a pattern, and if found, replaces that pattern with the replacement text. It returns the number of substitutions made, if any; if no substitutions are made, it returns false. Optional modifiers: g replaces all occurrences of the pattern; e evaluates the replacement string as a Perl expression; for any other modifiers, see /PATTERN/ matching. Almost any delimiter may replace the slashes; if single quotes are used, no interpretation is done on the strings between the delimiters, otherwise the strings are interpolated as if inside double quotes. If bracketing delimiters are used, PATTERN and REPLACEMENT may have their own delimiters, e.g., s(foo)[bar]. If PATTERN is empty, the most recent pattern from a previous match or replacement is used.

[ $VAR =~ ] tr/SEARCHLIST/REPLACEMENTLIST/ [ c ] [ d ] [ s ]

Translates all occurrences of the characters found in the search list with the corresponding character in the replacement list. It returns the number of characters replaced. y may be used instead of tr. Optional modifiers: c complements the SEARCHLIST; d deletes all characters found in SEARCHLIST that do not have a corresponding character in REPLACEMENTLIST; s squeezes all sequences of characters that are translated into the same target character into one occurrence of this character.

pos SCALAR

Returns the position where the last m//g search left off for SCALAR. May be assigned to.

study [ $VAR† ]

Study the scalar variable $VAR in anticipation of performing many pattern matches on its contents before the variable is next modified.

File Test Operators

These unary operators takes one argument, either a filename or a filehandle, and test the associated file to see if something is true about it. If the argument is omitted, they test $_ (except for -t, which tests STDIN). If the special argument _ (underscore) is passed, they use the information from the preceding test or stat call.

-r -w -x

File is readable/writable/executable by effective uid/gid.

-R -W -X

File is readable/writable/executable by real uid/gid.

-o -O

File is owned by effective/real uid.

-e -z

File exists/has zero size.

-s

File exists and has non-zero size. Returns the size.

-f -d

File is a plain file/a directory.

-l -S -p

File is a symbolic link/a socket/a named pipe (FIFO).

-b -c

File is a block/character special file.

-u -g -k

File has setuid/setgid/sticky bit set.

-t

Tests if filehandle (STDIN by default) is opened to a tty.

-T -B

File is a text/non-text (binary) file. -T and -B return true on a null file, or a file at EOF when testing a filehandle.

-M -A -C

File modification / access / inode-change time. Measured in days. Value returned reflects the file age at the time the script started. See also $^T in the section Special Variables.

File Operations

Functions operating on a list of files return the number of files successfully operated upon.

chmod LIST

Changes the permissions of a list of files. The first element of the list must be the numerical mode.

chown LIST

Changes the owner and group of a list of files. The first two elements of the list must be the numerical uid and gid.

Changes the access and modification times. The first two elements of the list must be the numerical access and modification times.

Input / Output

In input/output operations, FILEHANDLE may be a filehandle as opened by the open operator, a predefined filehandle (e.g., STDOUT) or a scalar variable that evaluates to the name of a filehandle to be used.

<FILEHANDLE>

In scalar context, reads a single line from the file opened on FILEHANDLE. In array context, reads the whole file.

<>

Reads from the input stream formed by the files specified in @ARGV, or standard input if no arguments were supplied.

binmode FILEHANDLE

Arranges for the file opened on FILEHANDLE to be read or written in binary mode as opposed to text mode (null operation on UNIX).

close FILEHANDLE

Closes the file or pipe associated with the filehandle.

dbmclose%HASH

Deprecated, use untie instead.

dbmopen%HASH, DBMNAME, MODE

Deprecated, use tie instead.

eof FILEHANDLE

Returns true if the next read will return end of file, or if the file is not open.

eof

Returns the EOF status for the last file read.

eof()

Indicates EOF on the pseudo file formed of the files listed on the command line.

fcntl FILEHANDLE, FUNCTION,$VAR

Implements the fcntl(2) function. This function has non-standard return values.

Yields the next character from the file, or an empty string on end of file. If FILEHANDLE is omitted, reads from STDIN.

ioctl FILEHANDLE, FUNCTION,$VAR

Performs ioctl(2) on the file. This function has non-standard return values.

open FILEHANDLE [ , FILENAME ]

Opens a file and associates it with FILEHANDLE. If FILENAME is omitted, the scalar variable of the same name as the FILEHANDLE must contain the filename. The following filename conventions apply when opening a file.

"FILE"

open FILE for input. Also "<FILE".

">FILE"

open FILE for output, creating it if necessary.

">>FILE"

open FILE in append mode.

"+<FILE"

open FILE with read/write access (file must exist).

"+>FILE"

open FILE with read/write access (file truncated).

"|CMD"

opens a pipe to command CMD; forks if CMD is -.

"CMD|"

opens a pipe from command CMD; forks if CMD is -.

FILE may be &FILEHND in which case the new filehandle is connected to the (previously opened) filehandle FILEHND. If it is &=N, FILE will be connected to the given file descriptor. open returns undef upon failure, true otherwise.

pipe READHANDLE, WRITEHANDLE

Returns a pair of connected pipes.

print [ FILEHANDLE ] [ LIST† ]

Equivalent to print FILEHANDLE sprintf LIST.

printf[([FILEHANDLE] LIST†)]

Equivalent to print FILEHANDLE sprintf(LIST).

read FILEHANDLE,$VAR, LENGTH [ , OFFSET ]

Reads LENGTH binary bytes from the file into the variable at OFFSET. Returns number of bytes actually read.

seek FILEHANDLE, POSITION, WHENCE

Arbitarily positions the file. Returns true if successful.

select [ FILEHANDLE ]

Returns the currently selected filehandle. Sets the current default filehandle for output operations if FILEHANDLE is supplied.

select RBITS, WBITS, NBITS, TIMEOUT

Performs a select(2) system call with the same parameters.

sprintf FORMAT, LIST

Returns a string formatted by (almost all of) the usual printf(3) conventions.

sysread FILEHANDLE,$VAR, LENGTH [ , OFFSET ]

Reads LENGTH bytes into $VAR at OFFSET.

syswrite FILEHANDLE, SCALAR, LENGTH [ , OFFSET ]

Writes LENGTH bytes from SCALAR at OFFSET.

tell [ FILEHANDLE ]

Returns the current file position for the file. If FILENAME is omitted, assumes the file last read.

write [ FILEHANDLE ]

Writes a formatted record to the specified file, using the format associated with that file.

Formats

formline PICTURE, LIST

Formats LIST according to PICTURE and accumulates the result into $^A.

write [ FILEHANDLE ]

Writes a formatted record to the specified file, using the format associated with that file.

Formats are defined as follows:

format

[NAME]

=

FORMLIST

.

FORMLIST pictures the lines, and contains the arguments which will give values to the fields in the lines. NAME defaults to STDOUT if omitted.

Picture fields are:

@<<<...

left adjusted field, repeat the < to denote the desired width

@>>>...

right adjusted field

@|||...

centered field

@#.##...

numeric format with implied decimal point

@*

a multi-line field

Use ^ instead of @ for multiline block filling. Use ~ at the beginning of a line to suppress unwanted empty lines. Use ~~ at the beginning of a line to have this format line repeated until all fields are exhausted. Use $- to zero to force a page break on the next write. See also $^, $~, $^A, $^F, $- and $= in section Special Variables.

Directory Reading Routines

closedir DIRHANDLE

Closes a directory opened by opendir.

opendir DIRHANDLE, DIRNAME

Opens a directory on the handle specified.

readdir DIRHANDLE

Returns the next entry (or an array of entries) from the directory.

rewinddir DIRHANDLE

Positions the directory to the beginning.

seekdir DIRHANDLE, POS

Sets position for readdir on the directory.

telldir DIRHANDLE

Returns the position in the directory.

System Interaction

alarm EXPR

Schedules a SIGALRM to be delivered after EXPR seconds.

chdir [ EXPR ]

Changes the working directory. Uses $ENV{"HOME"} or $ENV{"LOGNAME"} if EXPR is omitted.

chroot FILENAME†

Changes the root directory for the process and its children.

die [ LIST ]

Prints the value of LIST to STDERR and exits with the current value of $! (errno). If $! is 0, exits with the value of ($? >> 8). If ($? >> 8) is 0, exits with 255. LIST defaults to "Died".

exec LIST

Executes the system command in LIST; does not return.

exit [ EXPR ]

Exits immediately with the value of EXPR, which defaults to 0 (zero). Calls END routines and object destructors before exiting.

fork

Does a fork(2) system call. Returns the process ID of the child to the parent process and zero to the child process.

getlogin

Returns the current login name as known by the system.

getpgrp [ PID ]

Returns the process group for process PID (0, or omitted, means the current process).

getppid

Returns the process ID of the parent process.

getpriority WHICH, WHO

Returns the current priority for a process, process group, or user.

glob PAT

Returns a list of filenames that match the shell pattern PAT.

kill LIST

Sends a signal to a list of processes. The first element of the list must be the signal to send (either numeric, or its name as a string).

setpgrp PID, PGRP

Sets the process group for the PID (0 means the current process).

setpriority WHICH, WHO, PRIORITY

Sets the current priority for a process, process group, or a user.

sleep [ EXPR ]

Causes the program to sleep for EXPR seconds, or forever if no EXPR. Returns the number of seconds actually slept.

syscall LIST

Calls the system call specified in the first element of the list, passing the rest of the list as arguments to the call.

system LIST

Does exactly the same thing as exec LIST except that a fork is performed first, and the parent process waits for the child process to complete.

times

Returns a 4-element array (0: $user, 1: $system, 2: $cuser, 3: $csystem) giving the user and system times, in seconds, for this process and the children of this process.

umask [ EXPR ]

Sets the umask for the process and returns the old one. If EXPR is omitted, returns current umask value.

wait

Waits for a child process to terminate and returns the process ID of the deceased process (-1 if none). The status is returned in $?.

waitpid PID, FLAGS

Performs the same function as the corresponding system call.

warn [ LIST ]

Prints the message on STDERR like die, but doesn't exit. LIST defaults to "Warning: something's wrong".

Networking

accept NEWSOCKET, GENERICSOCKET

Accepts a new socket.

bind SOCKET, NAME

Binds the NAME to the SOCKET.

connect SOCKET, NAME

Connects the NAME to the SOCKET.

getpeername SOCKET

Returns the socket address of the other end of the SOCKET.

getsockname SOCKET

Returns the name of the SOCKET.

getsockopt SOCKET, LEVEL, OPTNAME

Returns the socket options.

listen SOCKET, QUEUESIZE

Starts listening on the specified SOCKET.

recv SOCKET, SCALAR, LENGTH, FLAGS

Receives a message on SOCKET.

send SOCKET, MSG, FLAGS [ , TO ]

Sends a message on the SOCKET.

setsockopt SOCKET, LEVEL, OPTNAME, OPTVAL

Sets the requested socket option.

shutdown SOCKET, HOW

Shuts down a SOCKET.

socket SOCKET, DOMAIN, TYPE, PROTOCOL

Creates a SOCKET in DOMAIN with TYPE and PROTOCOL.

socketpair SOCKET1, SOCKET2, DOMAIN, TYPE, PROTOCOL

Works the same as socket, but creates a pair of bidirectional sockets.

System V IPC

You need to require "sys/ipc.ph" before you can use the symbolic names of the operations.

Executes the code between { and }. Traps runtime errors as described with eval(EXPR), in the section String Functions.

local VARIABLE

local( LIST )

Creates a scope for the listed variables local to the enclosing block, subroutine or eval.

my VARIABLE

my( LIST )

Creates a scope for the listed variables lexically local to the enclosing block, subroutine or eval.

ref EXPR†

Returns a true value if EXPR is a reference. Returns the package name if EXPR has been blessed into a package.

reset [ EXPR ]

Resets ?? searches so that they work again. EXPR is a list of single letters. All variables and arrays beginning with one of those letters are reset to their pristine state. Only affects the current package.