Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/sys/man/1perl/perlvar

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  | will give a
.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "PERLVAR 1"
.TH PERLVAR 1 "2002-11-24" "perl v5.8.0" "Perl Programmers Reference Guide"
.SH "NAME"
perlvar \- Perl predefined variables
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
.Sh "Predefined Names"
.IX Subsection "Predefined Names"
The following names have special meaning to Perl.  Most 
punctuation names have reasonable mnemonics, or analogs in the
shells.  Nevertheless, if you wish to use long variable names,
you need only say
.PP
.Vb 1
\&    use English;
.Ve
.PP
at the top of your program. This aliases all the short names to the long
names in the current package. Some even have medium names, generally
borrowed from \fBawk\fR. In general, it's best to use the
.PP
.Vb 1
\&    use English '-no_match_vars';
.Ve
.PP
invocation if you don't need \f(CW$PREMATCH\fR, \f(CW$MATCH\fR, or \f(CW$POSTMATCH\fR, as it avoids
a certain performance hit with the use of regular expressions. See
English.
.PP
Variables that depend on the currently selected filehandle may be set by
calling an appropriate object method on the IO::Handle object, although
this is less efficient than using the regular built-in variables. (Summary
lines below for this contain the word \s-1HANDLE\s0.) First you must say
.PP
.Vb 1
\&    use IO::Handle;
.Ve
.PP
after which you may use either
.PP
.Vb 1
\&    method HANDLE EXPR
.Ve
.PP
or more safely,
.PP
.Vb 1
\&    HANDLE->method(EXPR)
.Ve
.PP
Each method returns the old value of the IO::Handle attribute.
The methods each take an optional \s-1EXPR\s0, which, if supplied, specifies the
new value for the IO::Handle attribute in question.  If not supplied,
most methods do nothing to the current value\*(--except for
\&\fIautoflush()\fR, which will assume a 1 for you, just to be different.
.PP
Because loading in the IO::Handle class is an expensive operation, you should
learn how to use the regular built-in variables.
.PP
A few of these variables are considered \*(L"read\-only\*(R".  This means that if
you try to assign to this variable, either directly or indirectly through
a reference, you'll raise a run-time exception.
.PP
You should be very careful when modifying the default values of most
special variables described in this document. In most cases you want
to localize these variables before changing them, since if you don't,
the change may affect other modules which rely on the default values
of the special variables that you have changed. This is one of the
correct ways to read the whole file at once:
.PP
.Vb 4
\&    open my $fh, "foo" or die $!;
\&    local $/; # enable localized slurp mode
\&    my $content = <$fh>;
\&    close $fh;
.Ve
.PP
But the following code is quite bad:
.PP
.Vb 4
\&    open my $fh, "foo" or die $!;
\&    undef $/; # enable slurp mode
\&    my $content = <$fh>;
\&    close $fh;
.Ve
.PP
since some other module, may want to read data from some file in the
default \*(L"line mode\*(R", so if the code we have just presented has been
executed, the global value of \f(CW$/\fR is now changed for any other code
running inside the same Perl interpreter.
.PP
Usually when a variable is localized you want to make sure that this
change affects the shortest scope possible. So unless you are already
inside some short \f(CW\*(C`{}\*(C'\fR block, you should create one yourself. For
example:
.PP
.Vb 7
\&    my $content = '';
\&    open my $fh, "foo" or die $!;
\&    {
\&        local $/;
\&        $content = <$fh>;
\&    }
\&    close $fh;
.Ve
.PP
Here is an example of how your own code can go broken:
.PP
.Vb 8
\&    for (1..5){
\&        nasty_break();
\&        print "$_ ";
\&    }
\&    sub nasty_break {
\&        $_ = 5;
\&        # do something with $_
\&    }
.Ve
.PP
You probably expect this code to print:
.PP
.Vb 1
\&    1 2 3 4 5
.Ve
.PP
but instead you get:
.PP
.Vb 1
\&    5 5 5 5 5
.Ve
.PP
Why? Because \fInasty_break()\fR modifies \f(CW$_\fR without localizing it
first. The fix is to add \fIlocal()\fR:
.PP
.Vb 1
\&        local $_ = 5;
.Ve
.PP
It's easy to notice the problem in such a short example, but in more
complicated code you are looking for trouble if you don't localize
changes to the special variables.
.PP
The following list is ordered by scalar variables first, then the
arrays, then the hashes.
.IP "$ARG" 8
.IX Item "$ARG"
.PD 0
.IP "$_" 8
.IX Item "$_"
.PD
The default input and pattern-searching space.  The following pairs are
equivalent:
.Sp
.Vb 2
\&    while (<>) {...}    # equivalent only in while!
\&    while (defined($_ = <>)) {...}
.Ve
.Sp
.Vb 2
\&    /^Subject:/
\&    $_ =~ /^Subject:/
.Ve
.Sp
.Vb 2
\&    tr/a-z/A-Z/
\&    $_ =~ tr/a-z/A-Z/
.Ve
.Sp
.Vb 2
\&    chomp
\&    chomp($_)
.Ve
.Sp
Here are the places where Perl will assume \f(CW$_\fR even if you
don't use it:
.RS 8
.IP "\(bu" 3
Various unary functions, including functions like \fIord()\fR and \fIint()\fR, as well
as the all file tests (\f(CW\*(C`\-f\*(C'\fR, \f(CW\*(C`\-d\*(C'\fR) except for \f(CW\*(C`\-t\*(C'\fR, which defaults to
\&\s-1STDIN\s0.
.IP "\(bu" 3
Various list functions like \fIprint()\fR and \fIunlink()\fR.
.IP "\(bu" 3
The pattern matching operations \f(CW\*(C`m//\*(C'\fR, \f(CW\*(C`s///\*(C'\fR, and \f(CW\*(C`tr///\*(C'\fR when used
without an \f(CW\*(C`=~\*(C'\fR operator.
.IP "\(bu" 3
The default iterator variable in a \f(CW\*(C`foreach\*(C'\fR loop if no other
variable is supplied.
.IP "\(bu" 3
The implicit iterator variable in the \fIgrep()\fR and \fImap()\fR functions.
.IP "\(bu" 3
The default place to put an input record when a \f(CW\*(C`<FH>\*(C'\fR
operation's result is tested by itself as the sole criterion of a \f(CW\*(C`while\*(C'\fR
test.  Outside a \f(CW\*(C`while\*(C'\fR test, this will not happen.
.RE
.RS 8
.Sp
(Mnemonic: underline is understood in certain operations.)
.RE
.IP "$a" 8
.IX Item "$a"
.PD 0
.IP "$b" 8
.IX Item "$b"
.PD
Special package variables when using \fIsort()\fR, see \*(L"sort\*(R" in perlfunc.
Because of this specialness \f(CW$a\fR and \f(CW$b\fR don't need to be declared
(using \fIlocal()\fR, use vars, or \fIour()\fR) even when using the strict
vars pragma.  Don't lexicalize them with \f(CW\*(C`my $a\*(C'\fR or \f(CW\*(C`my $b\*(C'\fR
if you want to be able to use them in the \fIsort()\fR comparison block
or function.
.IP "$<\fIdigits\fR>" 8
.IX Item "$<digits>"
Contains the subpattern from the corresponding set of capturing
parentheses from the last pattern match, not counting patterns
matched in nested blocks that have been exited already.  (Mnemonic:
like \edigits.)  These variables are all read-only and dynamically
scoped to the current \s-1BLOCK\s0.
.IP "$MATCH" 8
.IX Item "$MATCH"
.PD 0
.IP "$&" 8
.PD
The string matched by the last successful pattern match (not counting
any matches hidden within a \s-1BLOCK\s0 or \fIeval()\fR enclosed by the current
\&\s-1BLOCK\s0).  (Mnemonic: like & in some editors.)  This variable is read-only
and dynamically scoped to the current \s-1BLOCK\s0.
.Sp
The use of this variable anywhere in a program imposes a considerable
performance penalty on all regular expression matches.  See \*(L"\s-1BUGS\s0\*(R".
.IP "$PREMATCH" 8
.IX Item "$PREMATCH"
.PD 0
.IP "$`" 8
.PD
The string preceding whatever was matched by the last successful
pattern match (not counting any matches hidden within a \s-1BLOCK\s0 or eval
enclosed by the current \s-1BLOCK\s0).  (Mnemonic: \f(CW\*(C``\*(C'\fR often precedes a quoted
string.)  This variable is read\-only.
.Sp
The use of this variable anywhere in a program imposes a considerable
performance penalty on all regular expression matches.  See \*(L"\s-1BUGS\s0\*(R".
.IP "$POSTMATCH" 8
.IX Item "$POSTMATCH"
.PD 0
.IP "$'" 8
.PD
The string following whatever was matched by the last successful
pattern match (not counting any matches hidden within a \s-1BLOCK\s0 or \fIeval()\fR
enclosed by the current \s-1BLOCK\s0).  (Mnemonic: \f(CW\*(C`'\*(C'\fR often follows a quoted
string.)  Example:
.Sp
.Vb 3
\&    local $_ = 'abcdefghi';
\&    /def/;
\&    print "$`:$&:$'\en";         # prints abc:def:ghi
.Ve
.Sp
This variable is read-only and dynamically scoped to the current \s-1BLOCK\s0.
.Sp
The use of this variable anywhere in a program imposes a considerable
performance penalty on all regular expression matches.  See \*(L"\s-1BUGS\s0\*(R".
.IP "$LAST_PAREN_MATCH" 8
.IX Item "$LAST_PAREN_MATCH"
.PD 0
.IP "$+" 8
.PD
The text matched by the last bracket of the last successful search pattern.
This is useful if you don't know which one of a set of alternative patterns
matched. For example:
.Sp
.Vb 1
\&    /Version: (.*)|Revision: (.*)/ && ($rev = $+);
.Ve
.Sp
(Mnemonic: be positive and forward looking.)
This variable is read-only and dynamically scoped to the current \s-1BLOCK\s0.
.IP "$^N" 8
.IX Item "$^N"
The text matched by the used group most-recently closed (i.e. the group
with the rightmost closing parenthesis) of the last successful search
pattern.  (Mnemonic: the (possibly) Nested parenthesis that most
recently closed.)
.Sp
This is primarily used inside \f(CW\*(C`(?{...})\*(C'\fR blocks for examining text
recently matched. For example, to effectively capture text to a variable
(in addition to \f(CW$1\fR, \f(CW$2\fR, etc.), replace \f(CW\*(C`(...)\*(C'\fR with
.Sp
.Vb 1
\&     (?:(...)(?{ $var = $^N }))
.Ve
.Sp
By setting and then using \f(CW$var\fR in this way relieves you from having to
worry about exactly which numbered set of parentheses they are.
.Sp
This variable is dynamically scoped to the current \s-1BLOCK\s0.
.IP "@LAST_MATCH_END" 8
.IX Item "@LAST_MATCH_END"
.PD 0
.IP "@+" 8
.PD
This array holds the offsets of the ends of the last successful
submatches in the currently active dynamic scope.  \f(CW$+[0]\fR is
the offset into the string of the end of the entire match.  This
is the same value as what the \f(CW\*(C`pos\*(C'\fR function returns when called
on the variable that was matched against.  The \fIn\fRth element
of this array holds the offset of the \fIn\fRth submatch, so
\&\f(CW$+[1]\fR is the offset past where \f(CW$1\fR ends, \f(CW$+[2]\fR the offset
past where \f(CW$2\fR ends, and so on.  You can use \f(CW$#+\fR to determine
how many subgroups were in the last successful match.  See the
examples given for the \f(CW\*(C`@\-\*(C'\fR variable.
.IP "$MULTILINE_MATCHING" 8
.IX Item "$MULTILINE_MATCHING"
.PD 0
.IP "$*" 8
.PD
Set to a non-zero integer value to do multi-line matching within a
string, 0 (or undefined) to tell Perl that it can assume that strings
contain a single line, for the purpose of optimizing pattern matches.
Pattern matches on strings containing multiple newlines can produce
confusing results when \f(CW$*\fR is 0 or undefined. Default is undefined.
(Mnemonic: * matches multiple things.) This variable influences the
interpretation of only \f(CW\*(C`^\*(C'\fR and \f(CW\*(C`$\*(C'\fR. A literal newline can be searched
for even when \f(CW\*(C`$* == 0\*(C'\fR.
.Sp
Use of \f(CW$*\fR is deprecated in modern Perl, supplanted by 
the \f(CW\*(C`/s\*(C'\fR and \f(CW\*(C`/m\*(C'\fR modifiers on pattern matching.
.Sp
Assigning a non-numerical value to \f(CW$*\fR triggers a warning (and makes
\&\f(CW$*\fR act if \f(CW\*(C`$* == 0\*(C'\fR), while assigning a numerical value to \f(CW$*\fR
makes that an implicit \f(CW\*(C`int\*(C'\fR is applied on the value.
.IP "\s-1HANDLE\-\s0>input_line_number(\s-1EXPR\s0)" 8
.IX Item "HANDLE->input_line_number(EXPR)"
.PD 0
.IP "$INPUT_LINE_NUMBER" 8
.IX Item "$INPUT_LINE_NUMBER"
.IP "$NR" 8
.IX Item "$NR"
.IP "$." 8
.PD
Current line number for the last filehandle accessed. 
.Sp
Each filehandle in Perl counts the number of lines that have been read
from it.  (Depending on the value of \f(CW$/\fR, Perl's idea of what
constitutes a line may not match yours.)  When a line is read from a
filehandle (via \fIreadline()\fR or \f(CW\*(C`<>\*(C'\fR), or when \fItell()\fR or \fIseek()\fR is
called on it, \f(CW$.\fR becomes an alias to the line counter for that
filehandle.
.Sp
You can adjust the counter by assigning to \f(CW$.\fR, but this will not
actually move the seek pointer.  \fILocalizing \f(CI$.\fI will not localize
the filehandle's line count\fR.  Instead, it will localize perl's notion
of which filehandle \f(CW$.\fR is currently aliased to.
.Sp
\&\f(CW$.\fR is reset when the filehandle is closed, but \fBnot\fR when an open
filehandle is reopened without an intervening \fIclose()\fR.  For more
details, see "I/O Operators" in perlop.  Because \f(CW\*(C`<>\*(C'\fR never does
an explicit close, line numbers increase across \s-1ARGV\s0 files (but see
examples in \*(L"eof\*(R" in perlfunc).
.Sp
You can also use \f(CW\*(C`HANDLE\->input_line_number(EXPR)\*(C'\fR to access the
line counter for a given filehandle without having to worry about
which handle you last accessed.
.Sp
(Mnemonic: many programs use \*(L".\*(R" to mean the current line number.)
.IP "IO::Handle\->input_record_separator(\s-1EXPR\s0)" 8
.IX Item "IO::Handle->input_record_separator(EXPR)"
.PD 0
.IP "$INPUT_RECORD_SEPARATOR" 8
.IX Item "$INPUT_RECORD_SEPARATOR"
.IP "$RS" 8
.IX Item "$RS"
.IP "$/" 8
.PD
The input record separator, newline by default.  This 
influences Perl's idea of what a \*(L"line\*(R" is.  Works like \fBawk\fR's \s-1RS\s0
variable, including treating empty lines as a terminator if set to
the null string.  (An empty line cannot contain any spaces
or tabs.)  You may set it to a multi-character string to match a
multi-character terminator, or to \f(CW\*(C`undef\*(C'\fR to read through the end
of file.  Setting it to \f(CW"\en\en"\fR means something slightly
different than setting to \f(CW""\fR, if the file contains consecutive
empty lines.  Setting to \f(CW""\fR will treat two or more consecutive
empty lines as a single empty line.  Setting to \f(CW"\en\en"\fR will
blindly assume that the next input character belongs to the next
paragraph, even if it's a newline.  (Mnemonic: / delimits
line boundaries when quoting poetry.)
.Sp
.Vb 3
\&    local $/;           # enable "slurp" mode
\&    local $_ = <FH>;    # whole file now here
\&    s/\en[ \et]+/ /g;
.Ve
.Sp
Remember: the value of \f(CW$/\fR is a string, not a regex.  \fBawk\fR has to be
better for something. :\-)
.Sp
Setting \f(CW$/\fR to a reference to an integer, scalar containing an integer, or
scalar that's convertible to an integer will attempt to read records
instead of lines, with the maximum record size being the referenced
integer.  So this:
.Sp
.Vb 3
\&    local $/ = \e32768; # or \e"32768", or \e$var_containing_32768
\&    open my $fh, $myfile or die $!;
\&    local $_ = <$fh>;
.Ve
.Sp
will read a record of no more than 32768 bytes from \s-1FILE\s0.  If you're
not reading from a record-oriented file (or your \s-1OS\s0 doesn't have
record-oriented files), then you'll likely get a full chunk of data
with every read.  If a record is larger than the record size you've
set, you'll get the record back in pieces.
.Sp
On \s-1VMS\s0, record reads are done with the equivalent of \f(CW\*(C`sysread\*(C'\fR,
so it's best not to mix record and non-record reads on the same
file.  (This is unlikely to be a problem, because any file you'd
want to read in record mode is probably unusable in line mode.)
Non-VMS systems do normal I/O, so it's safe to mix record and
non-record reads of a file.
.Sp
See also \*(L"Newlines\*(R" in perlport.  Also see \f(CW$.\fR.
.IP "\s-1HANDLE\-\s0>autoflush(\s-1EXPR\s0)" 8
.IX Item "HANDLE->autoflush(EXPR)"
.PD 0
.IP "$OUTPUT_AUTOFLUSH" 8
.IX Item "$OUTPUT_AUTOFLUSH"
.IP "$|" 8
.PD
If set to nonzero, forces a flush right away and after every write
or print on the currently selected output channel.  Default is 0
(regardless of whether the channel is really buffered by the
system or not; \f(CW$|\fR tells you only whether you've asked Perl
explicitly to flush after each write).  \s-1STDOUT\s0 will
typically be line buffered if output is to the terminal and block
buffered otherwise.  Setting this variable is useful primarily when
you are outputting to a pipe or socket, such as when you are running
a Perl program under \fBrsh\fR and want to see the output as it's
happening.  This has no effect on input buffering.  See \*(L"getc\*(R" in perlfunc
for that.  (Mnemonic: when you want your pipes to be piping hot.)
.IP "IO::Handle\->output_field_separator \s-1EXPR\s0" 8
.IX Item "IO::Handle->output_field_separator EXPR"
.PD 0
.IP "$OUTPUT_FIELD_SEPARATOR" 8
.IX Item "$OUTPUT_FIELD_SEPARATOR"
.IP "$OFS" 8
.IX Item "$OFS"
.IP "$," 8
.PD
The output field separator for the print operator.  Ordinarily the
print operator simply prints out its arguments without further
adornment.  To get behavior more like \fBawk\fR, set this variable as
you would set \fBawk\fR's \s-1OFS\s0 variable to specify what is printed
between fields.  (Mnemonic: what is printed when there is a \*(L",\*(R" in
your print statement.)
.IP "IO::Handle\->output_record_separator \s-1EXPR\s0" 8
.IX Item "IO::Handle->output_record_separator EXPR"
.PD 0
.IP "$OUTPUT_RECORD_SEPARATOR" 8
.IX Item "$OUTPUT_RECORD_SEPARATOR"
.IP "$ORS" 8
.IX Item "$ORS"
.IP "$\e" 8
.IX Item "$"
.PD
The output record separator for the print operator.  Ordinarily the
print operator simply prints out its arguments as is, with no
trailing newline or other end-of-record string added.  To get
behavior more like \fBawk\fR, set this variable as you would set
\&\fBawk\fR's \s-1ORS\s0 variable to specify what is printed at the end of the
print.  (Mnemonic: you set \f(CW\*(C`$\e\*(C'\fR instead of adding \*(L"\en\*(R" at the
end of the print.  Also, it's just like \f(CW$/\fR, but it's what you
get \*(L"back\*(R" from Perl.)
.IP "$LIST_SEPARATOR" 8
.IX Item "$LIST_SEPARATOR"
.PD 0
.IP "$""" 8
.PD
This is like \f(CW$,\fR except that it applies to array and slice values
interpolated into a double-quoted string (or similar interpreted
string).  Default is a space.  (Mnemonic: obvious, I think.)
.IP "$SUBSCRIPT_SEPARATOR" 8
.IX Item "$SUBSCRIPT_SEPARATOR"
.PD 0
.IP "$SUBSEP" 8
.IX Item "$SUBSEP"
.IP "$;" 8
.PD
The subscript separator for multidimensional array emulation.  If you
refer to a hash element as
.Sp
.Vb 1
\&    $foo{$a,$b,$c}
.Ve
.Sp
it really means
.Sp
.Vb 1
\&    $foo{join($;, $a, $b, $c)}
.Ve
.Sp
But don't put
.Sp
.Vb 1
\&    @foo{$a,$b,$c}      # a slice--note the @
.Ve
.Sp
which means
.Sp
.Vb 1
\&    ($foo{$a},$foo{$b},$foo{$c})
.Ve
.Sp
Default is \*(L"\e034\*(R", the same as \s-1SUBSEP\s0 in \fBawk\fR.  If your
keys contain binary data there might not be any safe value for \f(CW$;\fR.
(Mnemonic: comma (the syntactic subscript separator) is a
semi\-semicolon.  Yeah, I know, it's pretty lame, but \f(CW$,\fR is already
taken for something more important.)
.Sp
Consider using \*(L"real\*(R" multidimensional arrays as described
in perllol.
.IP "$OFMT" 8
.IX Item "$OFMT"
.PD 0
.IP "$#" 8
.PD
The output format for printed numbers.  This variable is a half-hearted
attempt to emulate \fBawk\fR's \s-1OFMT\s0 variable.  There are times, however,
when \fBawk\fR and Perl have differing notions of what counts as 
numeric.  The initial value is "%.\fIn\fRg", where \fIn\fR is the value
of the macro \s-1DBL_DIG\s0 from your system's \fIfloat.h\fR.  This is different from
\&\fBawk\fR's default \s-1OFMT\s0 setting of \*(L"%.6g\*(R", so you need to set \f(CW$#\fR
explicitly to get \fBawk\fR's value.  (Mnemonic: # is the number sign.)
.Sp
Use of \f(CW$#\fR is deprecated.
.IP "\s-1HANDLE\-\s0>format_page_number(\s-1EXPR\s0)" 8
.IX Item "HANDLE->format_page_number(EXPR)"
.PD 0
.IP "$FORMAT_PAGE_NUMBER" 8
.IX Item "$FORMAT_PAGE_NUMBER"
.IP "$%" 8
.PD
The current page number of the currently selected output channel.
Used with formats.
(Mnemonic: % is page number in \fBnroff\fR.)
.IP "\s-1HANDLE\-\s0>format_lines_per_page(\s-1EXPR\s0)" 8
.IX Item "HANDLE->format_lines_per_page(EXPR)"
.PD 0
.IP "$FORMAT_LINES_PER_PAGE" 8
.IX Item "$FORMAT_LINES_PER_PAGE"
.IP "$=" 8
.PD
The current page length (printable lines) of the currently selected
output channel.  Default is 60.  
Used with formats.
(Mnemonic: = has horizontal lines.)
.IP "\s-1HANDLE\-\s0>format_lines_left(\s-1EXPR\s0)" 8
.IX Item "HANDLE->format_lines_left(EXPR)"
.PD 0
.IP "$FORMAT_LINES_LEFT" 8
.IX Item "$FORMAT_LINES_LEFT"
.IP "$\-" 8
.PD
The number of lines left on the page of the currently selected output
channel.  
Used with formats.
(Mnemonic: lines_on_page \- lines_printed.)
.IP "@LAST_MATCH_START" 8
.IX Item "@LAST_MATCH_START"
.PD 0
.IP "@\-" 8
.PD
$\-[0] is the offset of the start of the last successful match.
\&\f(CW\*(C`$\-[\*(C'\fR\fIn\fR\f(CW\*(C`]\*(C'\fR is the offset of the start of the substring matched by
\&\fIn\fR\-th subpattern, or undef if the subpattern did not match.
.Sp
Thus after a match against \f(CW$_\fR, $& coincides with \f(CW\*(C`substr $_, $\-[0],
$+[0] \- $\-[0]\*(C'\fR.  Similarly, \f(CW\*(C`$\*(C'\fR\fIn\fR coincides with \f(CW\*(C`substr $_, $\-[\*(C'\fR\fIn\fR\f(CW\*(C`],
$+[\*(C'\fR\fIn\fR\f(CW\*(C`] \- $\-[\*(C'\fR\fIn\fR\f(CW\*(C`]\*(C'\fR if \f(CW\*(C`$\-[\*(C'\fR\fIn\fR\f(CW\*(C`]\*(C'\fR is defined, and $+ coincides with
\&\f(CW\*(C`substr $_, $\-[$#\-], $+[$#\-]\*(C'\fR.  One can use \f(CW\*(C`$#\-\*(C'\fR to find the last
matched subgroup in the last successful match.  Contrast with
\&\f(CW$#+\fR, the number of subgroups in the regular expression.  Compare
with \f(CW\*(C`@+\*(C'\fR.
.Sp
This array holds the offsets of the beginnings of the last
successful submatches in the currently active dynamic scope.
\&\f(CW\*(C`$\-[0]\*(C'\fR is the offset into the string of the beginning of the
entire match.  The \fIn\fRth element of this array holds the offset
of the \fIn\fRth submatch, so \f(CW\*(C`$\-[1]\*(C'\fR is the offset where \f(CW$1\fR
begins, \f(CW\*(C`$\-[2]\*(C'\fR the offset where \f(CW$2\fR begins, and so on.
.Sp
After a match against some variable \f(CW$var:\fR
.RS 8
.ie n .IP "$`\fR is the same as \f(CW""substr($var, 0, $\-[0])""" 5
.el .IP "\f(CW$`\fR is the same as \f(CWsubstr($var, 0, $\-[0])\fR" 5
.IX Item "$` is the same as substr($var, 0, $-[0])"
.PD 0
.ie n .IP "$&\fR is the same as \f(CW""substr($var, $\-[0], $+[0] \- $\-[0])""" 5
.el .IP "\f(CW$&\fR is the same as \f(CWsubstr($var, $\-[0], $+[0] \- $\-[0])\fR" 5
.IX Item "$& is the same as substr($var, $-[0], $+[0] - $-[0])"
.ie n .IP "$'\fR is the same as \f(CW""substr($var, $+[0])""" 5
.el .IP "\f(CW$'\fR is the same as \f(CWsubstr($var, $+[0])\fR" 5
.IX Item "$' is the same as substr($var, $+[0])"
.ie n .IP "$1\fR is the same as \f(CW""substr($var, $\-[1], $+[1] \- $\-[1])""" 5
.el .IP "\f(CW$1\fR is the same as \f(CWsubstr($var, $\-[1], $+[1] \- $\-[1])\fR" 5
.IX Item "$1 is the same as substr($var, $-[1], $+[1] - $-[1])"
.ie n .IP "$2\fR is the same as \f(CW""substr($var, $\-[2], $+[2] \- $\-[2])""" 5
.el .IP "\f(CW$2\fR is the same as \f(CWsubstr($var, $\-[2], $+[2] \- $\-[2])\fR" 5
.IX Item "$2 is the same as substr($var, $-[2], $+[2] - $-[2])"
.ie n .IP "$3\fR is the same as \f(CW""substr $var, $\-[3], $+[3] \- $\-[3])""" 5
.el .IP "\f(CW$3\fR is the same as \f(CWsubstr $var, $\-[3], $+[3] \- $\-[3])\fR" 5
.IX Item "$3 is the same as substr $var, $-[3], $+[3] - $-[3])"
.RE
.RS 8
.RE
.IP "\s-1HANDLE\-\s0>format_name(\s-1EXPR\s0)" 8
.IX Item "HANDLE->format_name(EXPR)"
.IP "$FORMAT_NAME" 8
.IX Item "$FORMAT_NAME"
.IP "$~" 8
.PD
The name of the current report format for the currently selected output
channel.  Default is the name of the filehandle.  (Mnemonic: brother to
\&\f(CW$^\fR.)
.IP "\s-1HANDLE\-\s0>format_top_name(\s-1EXPR\s0)" 8
.IX Item "HANDLE->format_top_name(EXPR)"
.PD 0
.IP "$FORMAT_TOP_NAME" 8
.IX Item "$FORMAT_TOP_NAME"
.IP "$^" 8
.PD
The name of the current top-of-page format for the currently selected
output channel.  Default is the name of the filehandle with _TOP
appended.  (Mnemonic: points to top of page.)
.IP "IO::Handle\->format_line_break_characters \s-1EXPR\s0" 8
.IX Item "IO::Handle->format_line_break_characters EXPR"
.PD 0
.IP "$FORMAT_LINE_BREAK_CHARACTERS" 8
.IX Item "$FORMAT_LINE_BREAK_CHARACTERS"
.IP "$:" 8
.PD
The current set of characters after which a string may be broken to
fill continuation fields (starting with ^) in a format.  Default is
\&\*(L"\ \en\-\*(R", to break on whitespace or hyphens.  (Mnemonic: a \*(L"colon\*(R" in
poetry is a part of a line.)
.IP "IO::Handle\->format_formfeed \s-1EXPR\s0" 8
.IX Item "IO::Handle->format_formfeed EXPR"
.PD 0
.IP "$FORMAT_FORMFEED" 8
.IX Item "$FORMAT_FORMFEED"
.IP "$^L" 8
.IX Item "$^L"
.PD
What formats output as a form feed.  Default is \ef.
.IP "$ACCUMULATOR" 8
.IX Item "$ACCUMULATOR"
.PD 0
.IP "$^A" 8
.IX Item "$^A"
.PD
The current value of the \fIwrite()\fR accumulator for \fIformat()\fR lines.  A format
contains \fIformline()\fR calls that put their result into \f(CW$^A\fR.  After
calling its format, \fIwrite()\fR prints out the contents of \f(CW$^A\fR and empties.
So you never really see the contents of \f(CW$^A\fR unless you call
\&\fIformline()\fR yourself and then look at it.  See perlform and
\&\*(L"\fIformline()\fR\*(R" in perlfunc.
.IP "$CHILD_ERROR" 8
.IX Item "$CHILD_ERROR"
.PD 0
.IP "$?" 8
.PD
The status returned by the last pipe close, backtick (\f(CW``\fR) command,
successful call to \fIwait()\fR or \fIwaitpid()\fR, or from the \fIsystem()\fR
operator.  This is just the 16\-bit status word returned by the
\&\fIwait()\fR system call (or else is made up to look like it).  Thus, the
exit value of the subprocess is really (\f(CW\*(C`$? >> 8\*(C'\fR), and
\&\f(CW\*(C`$? & 127\*(C'\fR gives which signal, if any, the process died from, and
\&\f(CW\*(C`$? & 128\*(C'\fR reports whether there was a core dump.  (Mnemonic:
similar to \fBsh\fR and \fBksh\fR.)
.Sp
Additionally, if the \f(CW\*(C`h_errno\*(C'\fR variable is supported in C, its value
is returned via $? if any \f(CW\*(C`gethost*()\*(C'\fR function fails.
.Sp
If you have installed a signal handler for \f(CW\*(C`SIGCHLD\*(C'\fR, the
value of \f(CW$?\fR will usually be wrong outside that handler.
.Sp
Inside an \f(CW\*(C`END\*(C'\fR subroutine \f(CW$?\fR contains the value that is going to be
given to \f(CW\*(C`exit()\*(C'\fR.  You can modify \f(CW$?\fR in an \f(CW\*(C`END\*(C'\fR subroutine to
change the exit status of your program.  For example:
.Sp
.Vb 3
\&    END {
\&        $? = 1 if $? == 255;  # die would make it 255
\&    }
.Ve
.Sp
Under \s-1VMS\s0, the pragma \f(CW\*(C`use vmsish 'status'\*(C'\fR makes \f(CW$?\fR reflect the
actual \s-1VMS\s0 exit status, instead of the default emulation of \s-1POSIX\s0
status; see \*(L"$?\*(R" in perlvms for details.
.Sp
Also see \*(L"Error Indicators\*(R".
.IP "${^ENCODING}" 8
.IX Item "${^ENCODING}"
The \fIobject reference\fR to the Encode object that is used to convert
the source code to Unicode.  Thanks to this variable your perl script
does not have to be written in \s-1UTF\-8\s0.  Default is \fIundef\fR.  The direct
manipulation of this variable is highly discouraged.  See encoding
for more details.
.IP "$OS_ERROR" 8
.IX Item "$OS_ERROR"
.PD 0
.IP "$ERRNO" 8
.IX Item "$ERRNO"
.IP "$!" 8
.PD
If used numerically, yields the current value of the C \f(CW\*(C`errno\*(C'\fR
variable, or in other words, if a system or library call fails, it
sets this variable.  This means that the value of \f(CW$!\fR is meaningful
only \fIimmediately\fR after a \fBfailure\fR:
.Sp
.Vb 10
\&    if (open(FH, $filename)) {
\&        # Here $! is meaningless.
\&        ...
\&    } else {
\&        # ONLY here is $! meaningful.
\&        ...
\&        # Already here $! might be meaningless.
\&    }
\&    # Since here we might have either success or failure,
\&    # here $! is meaningless.
.Ve
.Sp
In the above \fImeaningless\fR stands for anything: zero, non\-zero,
\&\f(CW\*(C`undef\*(C'\fR.  A successful system or library call does \fBnot\fR set
the variable to zero.
.Sp
If used an a string, yields the corresponding system error string.
You can assign a number to \f(CW$!\fR to set \fIerrno\fR if, for instance,
you want \f(CW"$!"\fR to return the string for error \fIn\fR, or you want
to set the exit value for the \fIdie()\fR operator.  (Mnemonic: What just
went bang?)
.Sp
Also see \*(L"Error Indicators\*(R".
.IP "%!" 8
Each element of \f(CW\*(C`%!\*(C'\fR has a true value only if \f(CW$!\fR is set to that
value.  For example, \f(CW$!{ENOENT}\fR is true if and only if the current
value of \f(CW$!\fR is \f(CW\*(C`ENOENT\*(C'\fR; that is, if the most recent error was
\&\*(L"No such file or directory\*(R" (or its moral equivalent: not all operating
systems give that exact error, and certainly not all languages).
To check if a particular key is meaningful on your system, use
\&\f(CW\*(C`exists $!{the_key}\*(C'\fR; for a list of legal keys, use \f(CW\*(C`keys %!\*(C'\fR.
See Errno for more information, and also see above for the
validity of \f(CW$!\fR.
.IP "$EXTENDED_OS_ERROR" 8
.IX Item "$EXTENDED_OS_ERROR"
.PD 0
.IP "$^E" 8
.IX Item "$^E"
.PD
Error information specific to the current operating system.  At
the moment, this differs from \f(CW$!\fR under only \s-1VMS\s0, \s-1OS/2\s0, and Win32
(and for MacPerl).  On all other platforms, \f(CW$^E\fR is always just
the same as \f(CW$!\fR.
.Sp
Under \s-1VMS\s0, \f(CW$^E\fR provides the \s-1VMS\s0 status value from the last
system error.  This is more specific information about the last
system error than that provided by \f(CW$!\fR.  This is particularly
important when \f(CW$!\fR is set to \fB\s-1EVMSERR\s0\fR.
.Sp
Under \s-1OS/2\s0, \f(CW$^E\fR is set to the error code of the last call to
\&\s-1OS/2\s0 \s-1API\s0 either via \s-1CRT\s0, or directly from perl.
.Sp
Under Win32, \f(CW$^E\fR always returns the last error information
reported by the Win32 call \f(CW\*(C`GetLastError()\*(C'\fR which describes
the last error from within the Win32 \s-1API\s0.  Most Win32\-specific
code will report errors via \f(CW$^E\fR.  \s-1ANSI\s0 C and Unix-like calls
set \f(CW\*(C`errno\*(C'\fR and so most portable Perl code will report errors
via \f(CW$!\fR. 
.Sp
Caveats mentioned in the description of \f(CW$!\fR generally apply to
\&\f(CW$^E\fR, also.  (Mnemonic: Extra error explanation.)
.Sp
Also see \*(L"Error Indicators\*(R".
.IP "$EVAL_ERROR" 8
.IX Item "$EVAL_ERROR"
.PD 0
.IP "$@" 8
.PD
The Perl syntax error message from the last \fIeval()\fR operator.
If $@ is the null string, the last \fIeval()\fR parsed and executed
correctly (although the operations you invoked may have failed in the
normal fashion).  (Mnemonic: Where was the syntax error \*(L"at\*(R"?)
.Sp
Warning messages are not collected in this variable.  You can,
however, set up a routine to process warnings by setting \f(CW$SIG{_\|_WARN_\|_}\fR
as described below.
.Sp
Also see \*(L"Error Indicators\*(R".
.IP "$PROCESS_ID" 8
.IX Item "$PROCESS_ID"
.PD 0
.IP "$PID" 8
.IX Item "$PID"
.IP "$$" 8
.PD
The process number of the Perl running this script.  You should
consider this variable read\-only, although it will be altered
across \fIfork()\fR calls.  (Mnemonic: same as shells.)
.IP "$REAL_USER_ID" 8
.IX Item "$REAL_USER_ID"
.PD 0
.IP "$UID" 8
.IX Item "$UID"
.IP "$<" 8
.PD
The real uid of this process.  (Mnemonic: it's the uid you came \fIfrom\fR,
if you're running setuid.)  You can change both the real uid and
the effective uid at the same time by using \fIPOSIX::setuid()\fR.
.IP "$EFFECTIVE_USER_ID" 8
.IX Item "$EFFECTIVE_USER_ID"
.PD 0
.IP "$EUID" 8
.IX Item "$EUID"
.IP "$>" 8
.PD
The effective uid of this process.  Example:
.Sp
.Vb 2
\&    $< = $>;            # set real to effective uid
\&    ($<,$>) = ($>,$<);  # swap real and effective uid
.Ve
.Sp
You can change both the effective uid and the real uid at the same
time by using \fIPOSIX::setuid()\fR.
.Sp
(Mnemonic: it's the uid you went \fIto\fR, if you're running setuid.)
\&\f(CW$<\fR and \f(CW$>\fR can be swapped only on machines
supporting \fIsetreuid()\fR.
.IP "$REAL_GROUP_ID" 8
.IX Item "$REAL_GROUP_ID"
.PD 0
.IP "$GID" 8
.IX Item "$GID"
.IP "$(" 8
.PD
The real gid of this process.  If you are on a machine that supports
membership in multiple groups simultaneously, gives a space separated
list of groups you are in.  The first number is the one returned by
\&\fIgetgid()\fR, and the subsequent ones by \fIgetgroups()\fR, one of which may be
the same as the first number.
.Sp
However, a value assigned to \f(CW$(\fR must be a single number used to
set the real gid.  So the value given by \f(CW$(\fR should \fInot\fR be assigned
back to \f(CW$(\fR without being forced numeric, such as by adding zero.
.Sp
You can change both the real gid and the effective gid at the same
time by using \fIPOSIX::setgid()\fR.
.Sp
(Mnemonic: parentheses are used to \fIgroup\fR things.  The real gid is the
group you \fIleft\fR, if you're running setgid.)
.IP "$EFFECTIVE_GROUP_ID" 8
.IX Item "$EFFECTIVE_GROUP_ID"
.PD 0
.IP "$EGID" 8
.IX Item "$EGID"
.IP "$)" 8
.PD
The effective gid of this process.  If you are on a machine that
supports membership in multiple groups simultaneously, gives a space
separated list of groups you are in.  The first number is the one
returned by \fIgetegid()\fR, and the subsequent ones by \fIgetgroups()\fR, one of
which may be the same as the first number.
.Sp
Similarly, a value assigned to \f(CW$)\fR must also be a space-separated
list of numbers.  The first number sets the effective gid, and
the rest (if any) are passed to \fIsetgroups()\fR.  To get the effect of an
empty list for \fIsetgroups()\fR, just repeat the new effective gid; that is,
to force an effective gid of 5 and an effectively empty \fIsetgroups()\fR
list, say \f(CW\*(C` $) = "5 5" \*(C'\fR.
.Sp
You can change both the effective gid and the real gid at the same
time by using \fIPOSIX::setgid()\fR (use only a single numeric argument).
.Sp
(Mnemonic: parentheses are used to \fIgroup\fR things.  The effective gid
is the group that's \fIright\fR for you, if you're running setgid.)
.Sp
\&\f(CW$<\fR, \f(CW$>\fR, \f(CW$(\fR and \f(CW$)\fR can be set only on
machines that support the corresponding \fIset[re][ug]\fIid()\fI\fR routine.  \f(CW$(\fR
and \f(CW$)\fR can be swapped only on machines supporting \fIsetregid()\fR.
.IP "$PROGRAM_NAME" 8
.IX Item "$PROGRAM_NAME"
.PD 0
.IP "$0" 8
.IX Item "$0"
.PD
Contains the name of the program being executed.  On some operating
systems assigning to \f(CW$0\fR modifies the argument area that the \fBps\fR
program sees.  This is more useful as a way of indicating the current
program state than it is for hiding the program you're running.
(Mnemonic: same as \fBsh\fR and \fBksh\fR.)
.Sp
Note for \s-1BSD\s0 users: setting \f(CW$0\fR does not completely remove \*(L"perl\*(R"
from the \fIps\fR\|(1) output.  For example, setting \f(CW$0\fR to \f(CW"foobar"\fR will
result in \f(CW"perl: foobar (perl)"\fR.  This is an operating system
feature.
.IP "$[" 8
The index of the first element in an array, and of the first character
in a substring.  Default is 0, but you could theoretically set it
to 1 to make Perl behave more like \fBawk\fR (or Fortran) when
subscripting and when evaluating the \fIindex()\fR and \fIsubstr()\fR functions.
(Mnemonic: [ begins subscripts.)
.Sp
As of release 5 of Perl, assignment to \f(CW$[\fR is treated as a compiler
directive, and cannot influence the behavior of any other file.
Its use is highly discouraged.
.IP "$]" 8
The version + patchlevel / 1000 of the Perl interpreter.  This variable
can be used to determine whether the Perl interpreter executing a
script is in the right range of versions.  (Mnemonic: Is this version
of perl in the right bracket?)  Example:
.Sp
.Vb 1
\&    warn "No checksumming!\en" if $] < 3.019;
.Ve
.Sp
See also the documentation of \f(CW\*(C`use VERSION\*(C'\fR and \f(CW\*(C`require VERSION\*(C'\fR
for a convenient way to fail if the running Perl interpreter is too old.
.Sp
The floating point representation can sometimes lead to inaccurate
numeric comparisons.  See \f(CW$^V\fR for a more modern representation of
the Perl version that allows accurate string comparisons.
.IP "$COMPILING" 8
.IX Item "$COMPILING"
.PD 0
.IP "$^C" 8
.IX Item "$^C"
.PD
The current value of the flag associated with the \fB\-c\fR switch.
Mainly of use with \fB\-MO=...\fR to allow code to alter its behavior
when being compiled, such as for example to \s-1AUTOLOAD\s0 at compile
time rather than normal, deferred loading.  See perlcc.  Setting
\&\f(CW\*(C`$^C = 1\*(C'\fR is similar to calling \f(CW\*(C`B::minus_c\*(C'\fR.
.IP "$DEBUGGING" 8
.IX Item "$DEBUGGING"
.PD 0
.IP "$^D" 8
.IX Item "$^D"
.PD
The current value of the debugging flags.  (Mnemonic: value of \fB\-D\fR
switch.)
.IP "$SYSTEM_FD_MAX" 8
.IX Item "$SYSTEM_FD_MAX"
.PD 0
.IP "$^F" 8
.IX Item "$^F"
.PD
The maximum system file descriptor, ordinarily 2.  System file
descriptors are passed to \fIexec()\fRed processes, while higher file
descriptors are not.  Also, during an \fIopen()\fR, system file descriptors are
preserved even if the \fIopen()\fR fails.  (Ordinary file descriptors are
closed before the \fIopen()\fR is attempted.)  The close-on-exec
status of a file descriptor will be decided according to the value of
\&\f(CW$^F\fR when the corresponding file, pipe, or socket was opened, not the
time of the \fIexec()\fR.
.IP "$^H" 8
.IX Item "$^H"
\&\s-1WARNING:\s0 This variable is strictly for internal use only.  Its availability,
behavior, and contents are subject to change without notice.
.Sp
This variable contains compile-time hints for the Perl interpreter.  At the
end of compilation of a \s-1BLOCK\s0 the value of this variable is restored to the
value when the interpreter started to compile the \s-1BLOCK\s0.
.Sp
When perl begins to parse any block construct that provides a lexical scope
(e.g., eval body, required file, subroutine body, loop body, or conditional
block), the existing value of $^H is saved, but its value is left unchanged.
When the compilation of the block is completed, it regains the saved value.
Between the points where its value is saved and restored, code that
executes within \s-1BEGIN\s0 blocks is free to change the value of $^H.
.Sp
This behavior provides the semantic of lexical scoping, and is used in,
for instance, the \f(CW\*(C`use strict\*(C'\fR pragma.
.Sp
The contents should be an integer; different bits of it are used for
different pragmatic flags.  Here's an example:
.Sp
.Vb 1
\&    sub add_100 { $^H |= 0x100 }
.Ve
.Sp
.Vb 4
\&    sub foo {
\&        BEGIN { add_100() }
\&        bar->baz($boon);
\&    }
.Ve
.Sp
Consider what happens during execution of the \s-1BEGIN\s0 block.  At this point
the \s-1BEGIN\s0 block has already been compiled, but the body of \fIfoo()\fR is still
being compiled.  The new value of $^H will therefore be visible only while
the body of \fIfoo()\fR is being compiled.
.Sp
Substitution of the above \s-1BEGIN\s0 block with:
.Sp
.Vb 1
\&    BEGIN { require strict; strict->import('vars') }
.Ve
.Sp
demonstrates how \f(CW\*(C`use strict 'vars'\*(C'\fR is implemented.  Here's a conditional
version of the same lexical pragma:
.Sp
.Vb 1
\&    BEGIN { require strict; strict->import('vars') if $condition }
.Ve
.IP "%^H" 8
.IX Item "%^H"
\&\s-1WARNING:\s0 This variable is strictly for internal use only.  Its availability,
behavior, and contents are subject to change without notice.
.Sp
The %^H hash provides the same scoping semantic as $^H.  This makes it
useful for implementation of lexically scoped pragmas.
.IP "$INPLACE_EDIT" 8
.IX Item "$INPLACE_EDIT"
.PD 0
.IP "$^I" 8
.IX Item "$^I"
.PD
The current value of the inplace-edit extension.  Use \f(CW\*(C`undef\*(C'\fR to disable
inplace editing.  (Mnemonic: value of \fB\-i\fR switch.)
.IP "$^M" 8
.IX Item "$^M"
By default, running out of memory is an untrappable, fatal error.
However, if suitably built, Perl can use the contents of \f(CW$^M\fR
as an emergency memory pool after \fIdie()\fRing.  Suppose that your Perl
were compiled with \-DPERL_EMERGENCY_SBRK and used Perl's malloc.
Then
.Sp
.Vb 1
\&    $^M = 'a' x (1 << 16);
.Ve
.Sp
would allocate a 64K buffer for use in an emergency.  See the
\&\fI\s-1INSTALL\s0\fR file in the Perl distribution for information on how to
enable this option.  To discourage casual use of this advanced
feature, there is no English long name for this variable.
.IP "$OSNAME" 8
.IX Item "$OSNAME"
.PD 0
.IP "$^O" 8
.IX Item "$^O"
.PD
The name of the operating system under which this copy of Perl was
built, as determined during the configuration process.  The value
is identical to \f(CW$Config{'osname'}\fR.  See also Config and the 
\&\fB\-V\fR command-line switch documented in perlrun.
.Sp
In Windows platforms, $^O is not very helpful: since it is always
\&\f(CW\*(C`MSWin32\*(C'\fR, it doesn't tell the difference between
95/98/ME/NT/2000/XP/CE/.NET.  Use \fIWin32::GetOSName()\fR or
\&\fIWin32::GetOSVersion()\fR (see Win32 and perlport) to distinguish
between the variants.
.IP "${^OPEN}" 8
.IX Item "${^OPEN}"
An internal variable used by PerlIO.  A string in two parts, separated
by a \f(CW\*(C`\e0\*(C'\fR byte, the first part describes the input layers, the second
part describes the output layers.
.IP "$PERLDB" 8
.IX Item "$PERLDB"
.PD 0
.IP "$^P" 8
.IX Item "$^P"
.PD
The internal variable for debugging support.  The meanings of the
various bits are subject to change, but currently indicate:
.RS 8
.IP "0x01" 6
.IX Item "0x01"
Debug subroutine enter/exit.
.IP "0x02" 6
.IX Item "0x02"
Line-by-line debugging.
.IP "0x04" 6
.IX Item "0x04"
Switch off optimizations.
.IP "0x08" 6
.IX Item "0x08"
Preserve more data for future interactive inspections.
.IP "0x10" 6
.IX Item "0x10"
Keep info about source lines on which a subroutine is defined.
.IP "0x20" 6
.IX Item "0x20"
Start with single-step on.
.IP "0x40" 6
.IX Item "0x40"
Use subroutine address instead of name when reporting.
.IP "0x80" 6
.IX Item "0x80"
Report \f(CW\*(C`goto &subroutine\*(C'\fR as well.
.IP "0x100" 6
.IX Item "0x100"
Provide informative \*(L"file\*(R" names for evals based on the place they were compiled.
.IP "0x200" 6
.IX Item "0x200"
Provide informative names to anonymous subroutines based on the place they
were compiled.
.RE
.RS 8
.Sp
Some bits may be relevant at compile-time only, some at
run-time only.  This is a new mechanism and the details may change.
.RE
.IP "$LAST_REGEXP_CODE_RESULT" 8
.IX Item "$LAST_REGEXP_CODE_RESULT"
.PD 0
.IP "$^R" 8
.IX Item "$^R"
.PD
The result of evaluation of the last successful \f(CW\*(C`(?{ code })\*(C'\fR
regular expression assertion (see perlre).  May be written to.
.IP "$EXCEPTIONS_BEING_CAUGHT" 8
.IX Item "$EXCEPTIONS_BEING_CAUGHT"
.PD 0
.IP "$^S" 8
.IX Item "$^S"
.PD
Current state of the interpreter.  Undefined if parsing of the current
module/eval is not finished (may happen in \f(CW$SIG\fR{_\|_DIE_\|_} and
\&\f(CW$SIG\fR{_\|_WARN_\|_} handlers).  True if inside an \fIeval()\fR, otherwise false.
.IP "$BASETIME" 8
.IX Item "$BASETIME"
.PD 0
.IP "$^T" 8
.IX Item "$^T"
.PD
The time at which the program began running, in seconds since the
epoch (beginning of 1970).  The values returned by the \fB\-M\fR, \fB\-A\fR,
and \fB\-C\fR filetests are based on this value.
.IP "${^TAINT}" 8
.IX Item "${^TAINT}"
Reflects if taint mode is on or off (i.e. if the program was run with
\&\fB\-T\fR or not).  True for on, false for off.
.IP "$PERL_VERSION" 8
.IX Item "$PERL_VERSION"
.PD 0
.IP "$^V" 8
.IX Item "$^V"
.PD
The revision, version, and subversion of the Perl interpreter, represented
as a string composed of characters with those ordinals.  Thus in Perl v5.6.0
it equals \f(CW\*(C`chr(5) . chr(6) . chr(0)\*(C'\fR and will return true for
\&\f(CW\*(C`$^V eq v5.6.0\*(C'\fR.  Note that the characters in this string value can
potentially be in Unicode range.
.Sp
This can be used to determine whether the Perl interpreter executing a
script is in the right range of versions.  (Mnemonic: use ^V for Version
Control.)  Example:
.Sp
.Vb 1
\&    warn "No \e"our\e" declarations!\en" if $^V and $^V lt v5.6.0;
.Ve
.Sp
To convert \f(CW$^V\fR into its string representation use \fIsprintf()\fR's
\&\f(CW"%vd"\fR conversion:
.Sp
.Vb 1
\&    printf "version is v%vd\en", $^V;  # Perl's version
.Ve
.Sp
See the documentation of \f(CW\*(C`use VERSION\*(C'\fR and \f(CW\*(C`require VERSION\*(C'\fR
for a convenient way to fail if the running Perl interpreter is too old.
.Sp
See also \f(CW$]\fR for an older representation of the Perl version.
.IP "$WARNING" 8
.IX Item "$WARNING"
.PD 0
.IP "$^W" 8
.IX Item "$^W"
.PD
The current value of the warning switch, initially true if \fB\-w\fR
was used, false otherwise, but directly modifiable.  (Mnemonic:
related to the \fB\-w\fR switch.)  See also warnings.
.IP "${^WARNING_BITS}" 8
.IX Item "${^WARNING_BITS}"
The current set of warning checks enabled by the \f(CW\*(C`use warnings\*(C'\fR pragma.
See the documentation of \f(CW\*(C`warnings\*(C'\fR for more details.
.IP "${^WIDE_SYSTEM_CALLS}" 8
.IX Item "${^WIDE_SYSTEM_CALLS}"
Global flag that enables system calls made by Perl to use wide character
APIs native to the system, if available.  This is currently only implemented
on the Windows platform.
.Sp
This can also be enabled from the command line using the \f(CW\*(C`\-C\*(C'\fR switch.
.Sp
The initial value is typically \f(CW0\fR for compatibility with Perl versions
earlier than 5.6, but may be automatically set to \f(CW1\fR by Perl if the system
provides a user-settable default (e.g., \f(CW$ENV{LC_CTYPE}\fR).
.Sp
The \f(CW\*(C`bytes\*(C'\fR pragma always overrides the effect of this flag in the current
lexical scope.  See bytes.
.IP "$EXECUTABLE_NAME" 8
.IX Item "$EXECUTABLE_NAME"
.PD 0
.IP "$^X" 8
.IX Item "$^X"
.PD
The name used to execute the current copy of Perl, from C's
\&\f(CW\*(C`argv[0]\*(C'\fR.
.Sp
Depending on the host operating system, the value of $^X may be
a relative or absolute pathname of the perl program file, or may
be the string used to invoke perl but not the pathname of the
perl program file.  Also, most operating systems permit invoking
programs that are not in the \s-1PATH\s0 environment variable, so there
is no guarantee that the value of $^X is in \s-1PATH\s0.  For \s-1VMS\s0, the
value may or may not include a version number.
.Sp
You usually can use the value of $^X to re-invoke an independent
copy of the same perl that is currently running, e.g.,
.Sp
.Vb 1
\&  @first_run = `$^X -le "print int rand 100 for 1..100"`;
.Ve
.Sp
But recall that not all operating systems support forking or
capturing of the output of commands, so this complex statement
may not be portable.
.Sp
It is not safe to use the value of $^X as a path name of a file,
as some operating systems that have a mandatory suffix on
executable files do not require use of the suffix when invoking
a command.  To convert the value of $^X to a path name, use the
following statements:
.Sp
# Build up a set of file names (not command names).
  use Config;
  \f(CW$this_perl\fR = $^X;
  if ($^O ne '\s-1VMS\s0')
     {$this_perl .= \f(CW$Config\fR{_exe}
          unless \f(CW$this_perl\fR =~ m/$Config{_exe}$/i;}
.Sp
Because many operating systems permit anyone with read access to
the Perl program file to make a copy of it, patch the copy, and
then execute the copy, the security-conscious Perl programmer
should take care to invoke the installed copy of perl, not the
copy referenced by $^X.  The following statements accomplish
this goal, and produce a pathname that can be invoked as a
command or referenced as a file.
.Sp
.Vb 5
\&  use Config;
\&  $secure_perl_path = $Config{perlpath};
\&  if ($^O ne 'VMS')
\&     {$secure_perl_path .= $Config{_exe}
\&          unless $secure_perl_path =~ m/$Config{_exe}$/i;}
.Ve
.IP "\s-1ARGV\s0" 8
.IX Item "ARGV"
The special filehandle that iterates over command-line filenames in
\&\f(CW@ARGV\fR. Usually written as the null filehandle in the angle operator
\&\f(CW\*(C`<>\*(C'\fR. Note that currently \f(CW\*(C`ARGV\*(C'\fR only has its magical effect
within the \f(CW\*(C`<>\*(C'\fR operator; elsewhere it is just a plain filehandle
corresponding to the last file opened by \f(CW\*(C`<>\*(C'\fR. In particular,
passing \f(CW\*(C`\e*ARGV\*(C'\fR as a parameter to a function that expects a filehandle
may not cause your function to automatically read the contents of all the
files in \f(CW@ARGV\fR.
.IP "$ARGV" 8
.IX Item "$ARGV"
contains the name of the current file when reading from <>.
.IP "@ARGV" 8
.IX Item "@ARGV"
The array \f(CW@ARGV\fR contains the command-line arguments intended for
the script.  \f(CW$#ARGV\fR is generally the number of arguments minus
one, because \f(CW$ARGV[0]\fR is the first argument, \fInot\fR the program's
command name itself.  See \f(CW$0\fR for the command name.
.IP "\s-1ARGVOUT\s0" 8
.IX Item "ARGVOUT"
The special filehandle that points to the currently open output file
when doing edit-in-place processing with \fB\-i\fR.  Useful when you have
to do a lot of inserting and don't want to keep modifying \f(CW$_\fR.  See
perlrun for the \fB\-i\fR switch.
.IP "@F" 8
.IX Item "@F"
The array \f(CW@F\fR contains the fields of each line read in when autosplit
mode is turned on.  See perlrun for the \fB\-a\fR switch.  This array
is package\-specific, and must be declared or given a full package name
if not in package main when running under \f(CW\*(C`strict 'vars'\*(C'\fR.
.IP "@INC" 8
.IX Item "@INC"
The array \f(CW@INC\fR contains the list of places that the \f(CW\*(C`do EXPR\*(C'\fR,
\&\f(CW\*(C`require\*(C'\fR, or \f(CW\*(C`use\*(C'\fR constructs look for their library files.  It
initially consists of the arguments to any \fB\-I\fR command-line
switches, followed by the default Perl library, probably
\&\fI/usr/local/lib/perl\fR, followed by \*(L".\*(R", to represent the current
directory.  (\*(L".\*(R" will not be appended if taint checks are enabled, either by
\&\f(CW\*(C`\-T\*(C'\fR or by \f(CW\*(C`\-t\*(C'\fR.)  If you need to modify this at runtime, you should use
the \f(CW\*(C`use lib\*(C'\fR pragma to get the machine-dependent library properly
loaded also:
.Sp
.Vb 2
\&    use lib '/mypath/libdir/';
\&    use SomeMod;
.Ve
.Sp
You can also insert hooks into the file inclusion system by putting Perl
code directly into \f(CW@INC\fR.  Those hooks may be subroutine references, array
references or blessed objects.  See \*(L"require\*(R" in perlfunc for details.
.IP "@_" 8
.IX Item "@_"
Within a subroutine the array \f(CW@_\fR contains the parameters passed to that
subroutine.  See perlsub.
.IP "%INC" 8
.IX Item "%INC"
The hash \f(CW%INC\fR contains entries for each filename included via the
\&\f(CW\*(C`do\*(C'\fR, \f(CW\*(C`require\*(C'\fR, or \f(CW\*(C`use\*(C'\fR operators.  The key is the filename
you specified (with module names converted to pathnames), and the
value is the location of the file found.  The \f(CW\*(C`require\*(C'\fR
operator uses this hash to determine whether a particular file has
already been included.
.Sp
If the file was loaded via a hook (e.g. a subroutine reference, see
\&\*(L"require\*(R" in perlfunc for a description of these hooks), this hook is
by default inserted into \f(CW%INC\fR in place of a filename.  Note, however,
that the hook may have set the \f(CW%INC\fR entry by itself to provide some more
specific info.
.IP "%ENV" 8
.IX Item "%ENV"
.PD 0
.IP "$ENV{expr}" 8
.IX Item "$ENV{expr}"
.PD
The hash \f(CW%ENV\fR contains your current environment.  Setting a
value in \f(CW\*(C`ENV\*(C'\fR changes the environment for any child processes
you subsequently \fIfork()\fR off.
.IP "%SIG" 8
.IX Item "%SIG"
.PD 0
.IP "$SIG{expr}" 8
.IX Item "$SIG{expr}"
.PD
The hash \f(CW%SIG\fR contains signal handlers for signals.  For example:
.Sp
.Vb 6
\&    sub handler {       # 1st argument is signal name
\&        my($sig) = @_;
\&        print "Caught a SIG$sig--shutting down\en";
\&        close(LOG);
\&        exit(0);
\&    }
.Ve
.Sp
.Vb 5
\&    $SIG{'INT'}  = \e&handler;
\&    $SIG{'QUIT'} = \e&handler;
\&    ...
\&    $SIG{'INT'}  = 'DEFAULT';   # restore default action
\&    $SIG{'QUIT'} = 'IGNORE';    # ignore SIGQUIT
.Ve
.Sp
Using a value of \f(CW'IGNORE'\fR usually has the effect of ignoring the
signal, except for the \f(CW\*(C`CHLD\*(C'\fR signal.  See perlipc for more about
this special case.
.Sp
Here are some other examples:
.Sp
.Vb 4
\&    $SIG{"PIPE"} = "Plumber";   # assumes main::Plumber (not recommended)
\&    $SIG{"PIPE"} = \e&Plumber;   # just fine; assume current Plumber
\&    $SIG{"PIPE"} = *Plumber;    # somewhat esoteric
\&    $SIG{"PIPE"} = Plumber();   # oops, what did Plumber() return??
.Ve
.Sp
Be sure not to use a bareword as the name of a signal handler,
lest you inadvertently call it. 
.Sp
If your system has the \fIsigaction()\fR function then signal handlers are
installed using it.  This means you get reliable signal handling.  If
your system has the \s-1SA_RESTART\s0 flag it is used when signals handlers are
installed.  This means that system calls for which restarting is supported
continue rather than returning when a signal arrives.  If you want your
system calls to be interrupted by signal delivery then do something like
this:
.Sp
.Vb 1
\&    use POSIX ':signal_h';
.Ve
.Sp
.Vb 3
\&    my $alarm = 0;
\&    sigaction SIGALRM, new POSIX::SigAction sub { $alarm = 1 }
\&        or die "Error setting SIGALRM handler: $!\en";
.Ve
.Sp
See \s-1POSIX\s0.
.Sp
Certain internal hooks can be also set using the \f(CW%SIG\fR hash.  The
routine indicated by \f(CW$SIG{_\|_WARN_\|_}\fR is called when a warning message is
about to be printed.  The warning message is passed as the first
argument.  The presence of a _\|_WARN_\|_ hook causes the ordinary printing
of warnings to \s-1STDERR\s0 to be suppressed.  You can use this to save warnings
in a variable, or turn warnings into fatal errors, like this:
.Sp
.Vb 2
\&    local $SIG{__WARN__} = sub { die $_[0] };
\&    eval $proggie;
.Ve
.Sp
The routine indicated by \f(CW$SIG{_\|_DIE_\|_}\fR is called when a fatal exception
is about to be thrown.  The error message is passed as the first
argument.  When a _\|_DIE_\|_ hook routine returns, the exception
processing continues as it would have in the absence of the hook,
unless the hook routine itself exits via a \f(CW\*(C`goto\*(C'\fR, a loop exit, or a \fIdie()\fR.
The \f(CW\*(C`_\|_DIE_\|_\*(C'\fR handler is explicitly disabled during the call, so that you
can die from a \f(CW\*(C`_\|_DIE_\|_\*(C'\fR handler.  Similarly for \f(CW\*(C`_\|_WARN_\|_\*(C'\fR.
.Sp
Due to an implementation glitch, the \f(CW$SIG{_\|_DIE_\|_}\fR hook is called
even inside an \fIeval()\fR.  Do not use this to rewrite a pending exception
in \f(CW$@\fR, or as a bizarre substitute for overriding \fICORE::GLOBAL::die()\fR.
This strange action at a distance may be fixed in a future release
so that \f(CW$SIG{_\|_DIE_\|_}\fR is only called if your program is about
to exit, as was the original intent.  Any other use is deprecated.
.Sp
\&\f(CW\*(C`_\|_DIE_\|_\*(C'\fR/\f(CW\*(C`_\|_WARN_\|_\*(C'\fR handlers are very special in one respect:
they may be called to report (probable) errors found by the parser.
In such a case the parser may be in inconsistent state, so any
attempt to evaluate Perl code from such a handler will probably
result in a segfault.  This means that warnings or errors that
result from parsing Perl should be used with extreme caution, like
this:
.Sp
.Vb 4
\&    require Carp if defined $^S;
\&    Carp::confess("Something wrong") if defined &Carp::confess;
\&    die "Something wrong, but could not load Carp to give backtrace...
\&         To see backtrace try starting Perl with -MCarp switch";
.Ve
.Sp
Here the first line will load Carp \fIunless\fR it is the parser who
called the handler.  The second line will print backtrace and die if
Carp was available.  The third line will be executed only if Carp was
not available.
.Sp
See \*(L"die\*(R" in perlfunc, \*(L"warn\*(R" in perlfunc, \*(L"eval\*(R" in perlfunc, and
warnings for additional information.
.Sh "Error Indicators"
.IX Subsection "Error Indicators"
The variables \f(CW$@\fR, \f(CW$!\fR, \f(CW$^E\fR, and \f(CW$?\fR contain information
about different types of error conditions that may appear during
execution of a Perl program.  The variables are shown ordered by
the \*(L"distance\*(R" between the subsystem which reported the error and
the Perl process.  They correspond to errors detected by the Perl
interpreter, C library, operating system, or an external program,
respectively.
.PP
To illustrate the differences between these variables, consider the 
following Perl expression, which uses a single-quoted string:
.PP
.Vb 5
\&    eval q{
\&        open my $pipe, "/cdrom/install |" or die $!;
\&        my @res = <$pipe>;
\&        close $pipe or die "bad pipe: $?, $!";
\&    };
.Ve
.PP
After execution of this statement all 4 variables may have been set.  
.PP
\&\f(CW$@\fR is set if the string to be \f(CW\*(C`eval\*(C'\fR\-ed did not compile (this
may happen if \f(CW\*(C`open\*(C'\fR or \f(CW\*(C`close\*(C'\fR were imported with bad prototypes),
or if Perl code executed during evaluation \fIdie()\fRd .  In these cases
the value of $@ is the compile error, or the argument to \f(CW\*(C`die\*(C'\fR
(which will interpolate \f(CW$!\fR and \f(CW$?\fR!).  (See also Fatal,
though.)
.PP
When the \fIeval()\fR expression above is executed, \fIopen()\fR, \f(CW\*(C`<PIPE>\*(C'\fR,
and \f(CW\*(C`close\*(C'\fR are translated to calls in the C run-time library and
thence to the operating system kernel.  \f(CW$!\fR is set to the C library's
\&\f(CW\*(C`errno\*(C'\fR if one of these calls fails. 
.PP
Under a few operating systems, \f(CW$^E\fR may contain a more verbose
error indicator, such as in this case, \*(L"\s-1CDROM\s0 tray not closed.\*(R"
Systems that do not support extended error messages leave \f(CW$^E\fR
the same as \f(CW$!\fR.
.PP
Finally, \f(CW$?\fR may be set to non\-0 value if the external program
\&\fI/cdrom/install\fR fails.  The upper eight bits reflect specific
error conditions encountered by the program (the program's \fIexit()\fR
value).   The lower eight bits reflect mode of failure, like signal
death and core dump information  See \fIwait\fR\|(2) for details.  In
contrast to \f(CW$!\fR and \f(CW$^E\fR, which are set only if error condition
is detected, the variable \f(CW$?\fR is set on each \f(CW\*(C`wait\*(C'\fR or pipe
\&\f(CW\*(C`close\*(C'\fR, overwriting the old value.  This is more like \f(CW$@\fR, which
on every \fIeval()\fR is always set on failure and cleared on success.
.PP
For more details, see the individual descriptions at \f(CW$@\fR, \f(CW$!\fR, \f(CW$^E\fR,
and \f(CW$?\fR.
.Sh "Technical Note on the Syntax of Variable Names"
.IX Subsection "Technical Note on the Syntax of Variable Names"
Variable names in Perl can have several formats.  Usually, they
must begin with a letter or underscore, in which case they can be
arbitrarily long (up to an internal limit of 251 characters) and
may contain letters, digits, underscores, or the special sequence
\&\f(CW\*(C`::\*(C'\fR or \f(CW\*(C`'\*(C'\fR.  In this case, the part before the last \f(CW\*(C`::\*(C'\fR or
\&\f(CW\*(C`'\*(C'\fR is taken to be a \fIpackage qualifier\fR; see perlmod.
.PP
Perl variable names may also be a sequence of digits or a single
punctuation or control character.  These names are all reserved for
special uses by Perl; for example, the all-digits names are used
to hold data captured by backreferences after a regular expression
match.  Perl has a special syntax for the single-control-character
names: It understands \f(CW\*(C`^X\*(C'\fR (caret \f(CW\*(C`X\*(C'\fR) to mean the control\-\f(CW\*(C`X\*(C'\fR
character.  For example, the notation \f(CW$^W\fR (dollar\-sign caret
\&\f(CW\*(C`W\*(C'\fR) is the scalar variable whose name is the single character
control\-\f(CW\*(C`W\*(C'\fR.  This is better than typing a literal control\-\f(CW\*(C`W\*(C'\fR
into your program.
.PP
Finally, new in Perl 5.6, Perl variable names may be alphanumeric
strings that begin with control characters (or better yet, a caret).
These variables must be written in the form \f(CW\*(C`${^Foo}\*(C'\fR; the braces
are not optional.  \f(CW\*(C`${^Foo}\*(C'\fR denotes the scalar variable whose
name is a control\-\f(CW\*(C`F\*(C'\fR followed by two \f(CW\*(C`o\*(C'\fR's.  These variables are
reserved for future special uses by Perl, except for the ones that
begin with \f(CW\*(C`^_\*(C'\fR (control\-underscore or caret\-underscore).  No
control-character name that begins with \f(CW\*(C`^_\*(C'\fR will acquire a special
meaning in any future version of Perl; such names may therefore be
used safely in programs.  \f(CW$^_\fR itself, however, \fIis\fR reserved.
.PP
Perl identifiers that begin with digits, control characters, or
punctuation characters are exempt from the effects of the \f(CW\*(C`package\*(C'\fR
declaration and are always forced to be in package \f(CW\*(C`main\*(C'\fR.  A few
other names are also exempt:
.PP
.Vb 5
\&        ENV             STDIN
\&        INC             STDOUT
\&        ARGV            STDERR
\&        ARGVOUT
\&        SIG
.Ve
.PP
In particular, the new special \f(CW\*(C`${^_XYZ}\*(C'\fR variables are always taken
to be in package \f(CW\*(C`main\*(C'\fR, regardless of any \f(CW\*(C`package\*(C'\fR declarations
presently in scope.
.SH "BUGS"
.IX Header "BUGS"
Due to an unfortunate accident of Perl's implementation, \f(CW\*(C`use
English\*(C'\fR imposes a considerable performance penalty on all regular
expression matches in a program, regardless of whether they occur
in the scope of \f(CW\*(C`use English\*(C'\fR.  For that reason, saying \f(CW\*(C`use
English\*(C'\fR in libraries is strongly discouraged.  See the
Devel::SawAmpersand module documentation from \s-1CPAN\s0
( http://www.cpan.org/modules/by\-module/Devel/ )
for more information.
.PP
Having to even think about the \f(CW$^S\fR variable in your exception
handlers is simply wrong.  \f(CW$SIG{_\|_DIE_\|_}\fR as currently implemented
invites grievous and difficult to track down errors.  Avoid it
and use an \f(CW\*(C`END{}\*(C'\fR or CORE::GLOBAL::die override instead.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].