Perl Punctuation Variables

use English;
...
if ($ERRNO =~ /denied/) { ... }

This module provides aliases for the built-in "punctuation variables.
They have side effects triggered merely by accessing them (like $0).
Some are read only (assignment has no effect).


@_ $_ $& $` $' $+ $* $. $/ $| $, $\ $" $; $% $= $- $~ $^ $: $# $?
$! $@ $$ $< $> $( $) $0 $[ $] $^A $^D $^F $^H $^I $^L $^O $^P $^T $^W $^X $digit

Perl English Comment
@_ @ARG Subroutine argument list.
$_ $ARG The default input and pattern searching space. Following pairs are equivalent:
while(<> {...} # while only while(defined($_=<>)) {...}
/^Subject:/ $_ =~ /^Subject:/
tr/a-z/A-Z/ $_ =~ tr/a-z/A-Z/
chop chop($_)
Here are places Perl assumes $_ even if you don't use it:
  • Unary functions like ord and int, as well as all file tests (-f, -d) except for -t, which defaults to STDIN.
  • List functions like print and unlink
  • Pattern matching operations m//, s//, and tr// when used without an =~ operator
  • Default iterator in a foreach loop if no other variable is supplied.
  • The implicit iterator variable in the grep and map functions.
  • The default placeto put an input record when a operation's result is tested by itself as teh sole criterion of a while test. Does not happen outside a while test.
  • $& $MATCH The string mactched by the last successful pattern match, not counting any matches hidden within a block or eval enclosed by the current block. Read only. (1)
    $` $PREMATCH The string preceding whatever was matched by the last successful pattern match not counting any matches hidden within a block or eval enclosed by the current block. Read only. (1)
    $' $POSTMATCH The string following whatever was matched by the last successful pattern match not counting any matches hidden within a block or eval enclosed by the current block. Read only. (1)
    $+ $LAST_PAREN_MATCH The last bracket matched by the last search pattern. This is useful if you don't know which of a set of alterntative patterns matched. Read only. (1)
    $* $MULTILINE_MATCHING Set to 1 to do multi-line matching within a string, 0 to tell Perl that it can assume that strings contain a single line for the purpose of optimizing pattern matches. Pattern matches on strings contining multiple newlines can produce confusing results when $* is 0. Default is 0. Note this variable only influences the interpretation of ^ and $. A literal newline can be searched for even when $*==0. Deprecated (use /m and /s in the regular expression match instead). (1)
    $.$INPUT_LINE_NUMBER
    $NR
    Current input line number of last filehandle read. An explicit close on the filehandle resets the line number. Since <> never does and explicit close, line numbers increase across ARGV files (see eof).
    $/$INPUT_RECORD_SEPARATOR
    $RS
    The input record separator is newline by default. If set to the null string, treats blank lines as delimiters (as in awk). May be set to a multi-character delimiter. Setting it to "\n\n" is different than "", if the file contains consecutive blank lines. Setting it to "" will treat two or more consecutive blank lines as a single blank line. Setting it to "\n\n" means Perl will blindly assume that the next input character belongs to the next paragraph, even if it's a third newline.
    $| $OUTPUT_AUTOFLUSH If set to nonzero, forces an fflush(3) after every write or print on the currently selected output hcannel. Does not turn off buffering. Deafult is 0, which means STDOUT is line buffered to the terminal and block buffered otherwise. (2)
    $, $OUTPUT_FIELD_SEPARATOR
    $OFS
    The output field separator for the print operator. Ordinarily the print operator prints out the comma separated fields you specify. In order to get behavior more like awk set this variable as awk's OFS variable to specify what is printed between fields.
    $\ $OUTPUT_RECORD_SEPARATOR
    $ORS
    The output record separator for the print operator. Ordinarily the printoperator prints out the comma-separated fields specified with no trailing newline or other record separator. Se this variable to have equivalent behavior of awk's ORS variable.
    $" $LIST_SEPARATOR This is like $, above except it applies to list values interpolated into a double-quoted string (or similar interpreted string). Default is ' ' (SP).
    $; $SUBSCRIPT_SEPARATOR
    $SUBSEP
    The subscript separator for mult-dimensional array emulation. If a has element is referred to as: $foo{$a,$b,$c} it really means: $foo{jon($;, $a, $b, $c)} but don'y put @foo{$a ,$b,$c} which means ($foo{$a},$foo{$b},$foo{c}). Default is "\034", the same as SUBSEP in awk. Note that if your keys contain binary data there might not be any safe value for $;. This is for backward compatibility, so consider using "real" multi-dimensional arrays.
    $% $FORMAT_PAGE_NUMBER Curent page number of currently selected output channel. (2)
    $= $FORMAT_LINES_PER_PAGE The current page length (printable lines) of the currently selected output channel. Default is 60.(2)
    $- $FORMAT_LINES_LEFT The number of lines left on the page of the currently selected output channel. (2)
    $~ $FORMAT_NAME The name of the current report format for the currently selected output channel. Deafult is the name of the filehandle. (2)
    $^ $FORMAT_TOP_NAME The name of the current top of page format for the currently selected output channel. Default is name of the filehandle with _TOP appended.(2)
    $: $FORMAT_LINE_BREAK_CHARACTERS Current set of characters after which a string may be broken to fill continuation fields (starting with ^) in a format. Default is " \n-", to break on white space or hyphens.
    $#$OFMT Use of $# is deprecated nad maintained for backward compatibility. Use printf instead. $# contains the output format for printed numbers. The default value is %.14g.
    $?$CHILD_ERROR The exit status of last child process. The status returned by the last pipe close, backtick (` `) command, or system operator. Note that this is the status word returned by the wait(2) system call, so the exit value of the subprocess is actually ($? >> 8). On many systems ($? & 255) gives which signal, if any, the process died from, and whether there was a core dump.
    $! $OS_ERROR
    $ERRORNO
    If used in a numeric context, yields the current ,b>errno variable (identifying the last system call error) in the current execution, with all the usual caveats (meaning has is uninitialized until first system error).
    $@ $EVAL_ERROR The Perl syntax error message from the last eval command. If null, the last eval was parsed and executed correctly (although the operations invoked may have failed in norma fashion). Note that warning messages are not collected in this variable. You can, setp up a routine to process warnings by setting $SIG{__WARN__}.
    $$$PROCESS_ID
    $PID
    The process number of the Perl running this script.
    $< $REAL_USER_ID
    $UID
    The real user ID (uid) of this process.
    $> $EFFECTIVE_USER_ID
    $EUID
    The effective uid of this process.
    $( $REAL_GROUP_ID
    $GID
    The real group ID (gid) of this process. Gives a space-separated list of groups (if in more than one group). The first number is the one returned by getgid(1), and the subsequent ones by getgroups(2) (one of which may be same as first number).
    $) $EFFECTIVE_GROUP_ID
    $EGID
    Effective gid of this process. If the system supports membership in multiple groups simultaneously, then a space separated list of group numbers is given.
    $0$PROGRAM_NAME Contains the name of the file containing the Perl script being executed.
    $[ The index of the first element in an array, and of the first character in a substring. Default is 0, but can be set to 1. Its use is discouraged.
    $] $PERL_VERSION Returns the (version + patchlevel/1000).
    $^A $ACCUMULATOR The current value of the write accumulator for format lines. A format contains formline commands that put their results into $^A. After calling its format, write prints out the contents of $^A and empties. The contents of $^A is thus null string unless you call formline yourself and then look at it.
    $^D $DEBUGGING Curent value of teh debugging flags (value of -D switch).
    $^F $SYSTEM_FD_MAX The maximum system file descriptor, ordinarily 2. System file descriptors are passed to execed processes, while higher file descriptors are not. System file descriptors are preserved even if an open fails. Ordinary fiel descriptors are closed before open is attempted, and stay closed if the open fails.
    $^H Internal compiler hints enabled by certain pragmatic modules.
    $^I $INPLACE_EDIT Current value of the inplace-edit extension. Use undef to disable inplace editing.
    $^L$FORMAT_LINEFEED Default is "\f".
    $^O $OSNAME Name of the operating system the currewnt Perl binary was compiled for.
    $^P $PERLDB The internal flag that the debugger clears so that it doesn't debug itself. Setting it disables debugging.
    $^T $BASETIME The time at which the script began running, in seconds since the epoch (beginning of 1970 for unix). Values returned by the -M, -A and -C filetests are based on this value.
    $^W $WARNING The current value of teh warning switch (-w), either true or false.
    $^X $EXECUTABLE_NAME The name of the Perl binary, from C's argv[0].
    $digit Contains text matched by corresponding number set of parenthesis in the last pattern matched, not counting patterns matched in nested blocks that have been exited already. Read only. (1)
    (1) Regular Expression Variables
    (2) Per-Filehandle Special Variables (requires: use Filehandle; after which you may use either: method HANDLE EXPR or HANDLE->method(EXPR))

    @_ $_ $& $` $' $+ $* $. $/ $| $, $\ $" $; $% $= $- $~ $^ $: $# $?
    $! $@ $$ $< $> $( $) $0 $[ $] $^A $^D $^F $^H $^I $^L $^O $^P $^T $^W $^X $digit