config root man

Current Path : /usr/opt/perl530/man/man1/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/opt/perl530/man/man1/perlvar.1

.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
.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.  \*(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-
.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" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" 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 "2019-10-24" "perl v5.30.2" "Perl Programmers Reference Guide"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
perlvar \- Perl predefined variables
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
.SS "The Syntax of Variable Names"
.IX Subsection "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`\*(Aq\*(C'\fR.  In this case, the part before the last \f(CW\*(C`::\*(C'\fR or
\&\f(CW\*(C`\*(Aq\*(C'\fR is taken to be a \fIpackage qualifier\fR; see perlmod.
A Unicode letter that is not \s-1ASCII\s0 is not considered to be a letter
unless \f(CW"use\ utf8"\fR is in effect, and somewhat more complicated
rules apply; see \*(L"Identifier parsing\*(R" in perldata for details.
.PP
Perl variable names may also be a sequence of digits, a single
punctuation character, or the two-character sequence: \f(CW\*(C`^\*(C'\fR (caret or
\&\s-1CIRCUMFLEX ACCENT\s0) followed by any one of the characters \f(CW\*(C`[][A\-Z^_?\e]\*(C'\fR.
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.
.PP
Since Perl v5.6.0, Perl variable names may also be alphanumeric strings
preceded by a caret.  These must all 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 considered to be 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 (caret-underscore).  No
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 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; they are
also exempt from \f(CW\*(C`strict \*(Aqvars\*(Aq\*(C'\fR errors.  A few other names are also
exempt in these ways:
.PP
.Vb 5
\&    ENV      STDIN
\&    INC      STDOUT
\&    ARGV     STDERR
\&    ARGVOUT
\&    SIG
.Ve
.PP
In particular, the 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 "SPECIAL VARIABLES"
.IX Header "SPECIAL VARIABLES"
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.  For more info, please see English.
.PP
Before you continue, note the sort order for variables.  In general, we
first list the variables in case-insensitive, almost-lexigraphical
order (ignoring the \f(CW\*(C`{\*(C'\fR or \f(CW\*(C`^\*(C'\fR preceding words, as in \f(CW\*(C`${^UNICODE}\*(C'\fR
or \f(CW$^T\fR), although \f(CW$_\fR and \f(CW@_\fR move up to the top of the pile.
For variables with the same identifier, we list it in order of scalar,
array, hash, and bareword.
.SS "General Variables"
.IX Subsection "General Variables"
.ie n .IP "$ARG" 8
.el .IP "\f(CW$ARG\fR" 8
.IX Item "$ARG"
.PD 0
.ie n .IP "$_" 8
.el .IP "\f(CW$_\fR" 8
.IX Xref "$_ $ARG"
.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($_ = <>)) {...}
\&
\&    /^Subject:/
\&    $_ =~ /^Subject:/
\&
\&    tr/a\-z/A\-Z/
\&    $_ =~ tr/a\-z/A\-Z/
\&
\&    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
The following functions use \f(CW$_\fR as a default argument:
.Sp
abs, alarm, chomp, chop, chr, chroot,
cos, defined, eval, evalbytes, exp, fc, glob, hex, int, lc,
lcfirst, length, log, lstat, mkdir, oct, ord, pos, print, printf,
quotemeta, readlink, readpipe, ref, require, reverse (in scalar context only),
rmdir, say, sin, split (for its second
argument), sqrt, stat, study, uc, ucfirst,
unlink, unpack.
.IP "\(bu" 3
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
See \*(L"\-X\*(R" in perlfunc
.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 (aka \f(CW\*(C`y///\*(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 \f(CW\*(C`grep()\*(C'\fR and \f(CW\*(C`map()\*(C'\fR functions.
.IP "\(bu" 3
The implicit variable of \f(CW\*(C`given()\*(C'\fR.
.IP "\(bu" 3
The default place to put the next value or input record
when a \f(CW\*(C`<FH>\*(C'\fR, \f(CW\*(C`readline\*(C'\fR, \f(CW\*(C`readdir\*(C'\fR or \f(CW\*(C`each\*(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
\&\f(CW$_\fR is a global variable.
.Sp
However, between perl v5.10.0 and v5.24.0, it could be used lexically by
writing \f(CW\*(C`my $_\*(C'\fR.  Making \f(CW$_\fR refer to the global \f(CW$_\fR in the same scope
was then possible with \f(CW\*(C`our $_\*(C'\fR.  This experimental feature was removed and is
now a fatal error, but you may encounter it in older code.
.Sp
Mnemonic: underline is understood in certain operations.
.RE
.ie n .IP "@ARG" 8
.el .IP "\f(CW@ARG\fR" 8
.IX Item "@ARG"
.PD 0
.ie n .IP "@_" 8
.el .IP "\f(CW@_\fR" 8
.IX Xref "@_ @ARG"
.IX Item "@_"
.PD
Within a subroutine the array \f(CW@_\fR contains the parameters passed to
that subroutine.  Inside a subroutine, \f(CW@_\fR is the default array for
the array operators \f(CW\*(C`pop\*(C'\fR and \f(CW\*(C`shift\*(C'\fR.
.Sp
See perlsub.
.ie n .IP "$LIST_SEPARATOR" 8
.el .IP "\f(CW$LIST_SEPARATOR\fR" 8
.IX Item "$LIST_SEPARATOR"
.PD 0
.IP "$""" 8
.IX Xref "$"" $LIST_SEPARATOR"
.PD
When an array or an array slice is interpolated into a double-quoted
string or a similar context such as \f(CW\*(C`/.../\*(C'\fR, its elements are
separated by this value.  Default is a space.  For example, this:
.Sp
.Vb 1
\&    print "The array is: @array\en";
.Ve
.Sp
is equivalent to this:
.Sp
.Vb 1
\&    print "The array is: " . join($", @array) . "\en";
.Ve
.Sp
Mnemonic: works in double-quoted context.
.ie n .IP "$PROCESS_ID" 8
.el .IP "\f(CW$PROCESS_ID\fR" 8
.IX Item "$PROCESS_ID"
.PD 0
.ie n .IP "$PID" 8
.el .IP "\f(CW$PID\fR" 8
.IX Item "$PID"
.IP "$$" 8
.IX Xref "$$ $PID $PROCESS_ID"
.PD
The process number of the Perl running this script.  Though you \fIcan\fR set
this variable, doing so is generally discouraged, although it can be
invaluable for some testing purposes.  It will be reset automatically
across \f(CW\*(C`fork()\*(C'\fR calls.
.Sp
Note for Linux and Debian GNU/kFreeBSD users: Before Perl v5.16.0 perl
would emulate \s-1POSIX\s0 semantics on Linux systems using LinuxThreads, a
partial implementation of \s-1POSIX\s0 Threads that has since been superseded
by the Native \s-1POSIX\s0 Thread Library (\s-1NPTL\s0).
.Sp
LinuxThreads is now obsolete on Linux, and caching \f(CW\*(C`getpid()\*(C'\fR
like this made embedding perl unnecessarily complex (since you'd have
to manually update the value of $$), so now \f(CW$$\fR and \f(CW\*(C`getppid()\*(C'\fR
will always return the same values as the underlying C library.
.Sp
Debian GNU/kFreeBSD systems also used LinuxThreads up until and
including the 6.0 release, but after that moved to FreeBSD thread
semantics, which are POSIX-like.
.Sp
To see if your system is affected by this discrepancy check if
\&\f(CW\*(C`getconf GNU_LIBPTHREAD_VERSION | grep \-q NPTL\*(C'\fR returns a false
value.  \s-1NTPL\s0 threads preserve the \s-1POSIX\s0 semantics.
.Sp
Mnemonic: same as shells.
.ie n .IP "$PROGRAM_NAME" 8
.el .IP "\f(CW$PROGRAM_NAME\fR" 8
.IX Item "$PROGRAM_NAME"
.PD 0
.ie n .IP "$0" 8
.el .IP "\f(CW$0\fR" 8
.IX Xref "$0 $PROGRAM_NAME"
.IX Item "$0"
.PD
Contains the name of the program being executed.
.Sp
On some (but not all) operating systems assigning to \f(CW$0\fR modifies
the argument area that the \f(CW\*(C`ps\*(C'\fR program sees.  On some platforms you
may have to use special \f(CW\*(C`ps\*(C'\fR options or a different \f(CW\*(C`ps\*(C'\fR to see the
changes.  Modifying the \f(CW$0\fR is more useful as a way of indicating the
current program state than it is for hiding the program you're
running.
.Sp
Note that there are platform-specific limitations on the maximum
length of \f(CW$0\fR.  In the most extreme case it may be limited to the
space occupied by the original \f(CW$0\fR.
.Sp
In some platforms there may be arbitrary amount of padding, for
example space characters, after the modified name as shown by \f(CW\*(C`ps\*(C'\fR.
In some platforms this padding may extend all the way to the original
length of the argument area, no matter what you do (this is the case
for example with Linux 2.2).
.Sp
Note for \s-1BSD\s0 users: setting \f(CW$0\fR does not completely remove \*(L"perl\*(R"
from the \fBps\fR\|(1) output.  For example, setting \f(CW$0\fR to \f(CW"foobar"\fR may
result in \f(CW"perl: foobar (perl)"\fR (whether both the \f(CW"perl: "\fR prefix
and the \*(L" (perl)\*(R" suffix are shown depends on your exact \s-1BSD\s0 variant
and version).  This is an operating system feature, Perl cannot help it.
.Sp
In multithreaded scripts Perl coordinates the threads so that any
thread may modify its copy of the \f(CW$0\fR and the change becomes visible
to \fBps\fR\|(1) (assuming the operating system plays along).  Note that
the view of \f(CW$0\fR the other threads have will not change since they
have their own copies of it.
.Sp
If the program has been given to perl via the switches \f(CW\*(C`\-e\*(C'\fR or \f(CW\*(C`\-E\*(C'\fR,
\&\f(CW$0\fR will contain the string \f(CW"\-e"\fR.
.Sp
On Linux as of perl v5.14.0 the legacy process name will be set with
\&\f(CWprctl(2)\fR, in addition to altering the \s-1POSIX\s0 name via \f(CW\*(C`argv[0]\*(C'\fR as
perl has done since version 4.000.  Now system utilities that read the
legacy process name such as ps, top and killall will recognize the
name you set when assigning to \f(CW$0\fR.  The string you supply will be
cut off at 16 bytes, this is a limitation imposed by Linux.
.Sp
Mnemonic: same as \fBsh\fR and \fBksh\fR.
.ie n .IP "$REAL_GROUP_ID" 8
.el .IP "\f(CW$REAL_GROUP_ID\fR" 8
.IX Item "$REAL_GROUP_ID"
.PD 0
.ie n .IP "$GID" 8
.el .IP "\f(CW$GID\fR" 8
.IX Item "$GID"
.IP "$(" 8
.IX Xref "$( $GID $REAL_GROUP_ID"
.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
\&\f(CW\*(C`getgid()\*(C'\fR, and the subsequent ones by \f(CW\*(C`getgroups()\*(C'\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.  Note
that this is different to the effective gid (\f(CW$)\fR) which does take a
list.
.Sp
You can change both the real gid and the effective gid at the same
time by using \f(CW\*(C`POSIX::setgid()\*(C'\fR.  Changes
to \f(CW$(\fR require a check to \f(CW$!\fR
to detect any possible errors after an attempted change.
.Sp
Mnemonic: parentheses are used to \fIgroup\fR things.  The real gid is the
group you \fIleft\fR, if you're running setgid.
.ie n .IP "$EFFECTIVE_GROUP_ID" 8
.el .IP "\f(CW$EFFECTIVE_GROUP_ID\fR" 8
.IX Item "$EFFECTIVE_GROUP_ID"
.PD 0
.ie n .IP "$EGID" 8
.el .IP "\f(CW$EGID\fR" 8
.IX Item "$EGID"
.IP "$)" 8
.IX Xref "$) $EGID $EFFECTIVE_GROUP_ID"
.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 \f(CW\*(C`getegid()\*(C'\fR, and the subsequent ones by \f(CW\*(C`getgroups()\*(C'\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 \f(CW\*(C`setgroups()\*(C'\fR.  To get the effect of an
empty list for \f(CW\*(C`setgroups()\*(C'\fR, just repeat the new effective gid; that is,
to force an effective gid of 5 and an effectively empty \f(CW\*(C`setgroups()\*(C'\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 \f(CW\*(C`POSIX::setgid()\*(C'\fR (use only a single numeric argument).
Changes to \f(CW$)\fR require a check to \f(CW$!\fR to detect any possible errors
after an attempted change.
.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]\f(BIid()\fI\fR routine.  \f(CW$(\fR
and \f(CW$)\fR can be swapped only on machines supporting \f(CW\*(C`setregid()\*(C'\fR.
.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.
.ie n .IP "$REAL_USER_ID" 8
.el .IP "\f(CW$REAL_USER_ID\fR" 8
.IX Item "$REAL_USER_ID"
.PD 0
.ie n .IP "$UID" 8
.el .IP "\f(CW$UID\fR" 8
.IX Item "$UID"
.IP "$<" 8
.IX Xref "$< $UID $REAL_USER_ID"
.PD
The real uid of this process.  You can change both the real uid and the
effective uid at the same time by using \f(CW\*(C`POSIX::setuid()\*(C'\fR.  Since
changes to \f(CW$<\fR require a system call, check \f(CW$!\fR after a change
attempt to detect any possible errors.
.Sp
Mnemonic: it's the uid you came \fIfrom\fR, if you're running setuid.
.ie n .IP "$EFFECTIVE_USER_ID" 8
.el .IP "\f(CW$EFFECTIVE_USER_ID\fR" 8
.IX Item "$EFFECTIVE_USER_ID"
.PD 0
.ie n .IP "$EUID" 8
.el .IP "\f(CW$EUID\fR" 8
.IX Item "$EUID"
.IP "$>" 8
.IX Xref "$> $EUID $EFFECTIVE_USER_ID"
.PD
The effective uid of this process.  For example:
.Sp
.Vb 2
\&    $< = $>;            # set real to effective uid
\&    ($<,$>) = ($>,$<);  # swap real and effective uids
.Ve
.Sp
You can change both the effective uid and the real uid at the same
time by using \f(CW\*(C`POSIX::setuid()\*(C'\fR.  Changes to \f(CW$>\fR require a check
to \f(CW$!\fR to detect any possible errors after an attempted change.
.Sp
\&\f(CW$<\fR and \f(CW$>\fR can be swapped only on machines
supporting \f(CW\*(C`setreuid()\*(C'\fR.
.Sp
Mnemonic: it's the uid you went \fIto\fR, if you're running setuid.
.ie n .IP "$SUBSCRIPT_SEPARATOR" 8
.el .IP "\f(CW$SUBSCRIPT_SEPARATOR\fR" 8
.IX Item "$SUBSCRIPT_SEPARATOR"
.PD 0
.ie n .IP "$SUBSEP" 8
.el .IP "\f(CW$SUBSEP\fR" 8
.IX Item "$SUBSEP"
.IP "$;" 8
.IX Xref "$; $SUBSEP SUBSCRIPT_SEPARATOR"
.PD
The subscript separator for multidimensional array emulation.  If you
refer to a hash element as
.Sp
.Vb 1
\&    $foo{$x,$y,$z}
.Ve
.Sp
it really means
.Sp
.Vb 1
\&    $foo{join($;, $x, $y, $z)}
.Ve
.Sp
But don't put
.Sp
.Vb 1
\&    @foo{$x,$y,$z}      # a slice\-\-note the @
.Ve
.Sp
which means
.Sp
.Vb 1
\&    ($foo{$x},$foo{$y},$foo{$z})
.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.
.Sp
Consider using \*(L"real\*(R" multidimensional arrays as described
in perllol.
.Sp
Mnemonic: comma (the syntactic subscript separator) is a semi-semicolon.
.ie n .IP "$a" 8
.el .IP "\f(CW$a\fR" 8
.IX Item "$a"
.PD 0
.ie n .IP "$b" 8
.el .IP "\f(CW$b\fR" 8
.IX Xref "$a $b"
.IX Item "$b"
.PD
Special package variables when using \f(CW\*(C`sort()\*(C'\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 \f(CW\*(C`use vars\*(C'\fR, or \f(CW\*(C`our()\*(C'\fR) even when using the \f(CW\*(C`strict \*(Aqvars\*(Aq\*(C'\fR
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 \f(CW\*(C`sort()\*(C'\fR comparison block or function.
.ie n .IP "%ENV" 8
.el .IP "\f(CW%ENV\fR" 8
.IX Xref "%ENV"
.IX Item "%ENV"
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 \f(CW\*(C`fork()\*(C'\fR off.
.Sp
As of v5.18.0, both keys and values stored in \f(CW%ENV\fR are stringified.
.Sp
.Vb 7
\&    my $foo = 1;
\&    $ENV{\*(Aqbar\*(Aq} = \e$foo;
\&    if( ref $ENV{\*(Aqbar\*(Aq} ) {
\&        say "Pre 5.18.0 Behaviour";
\&    } else {
\&        say "Post 5.18.0 Behaviour";
\&    }
.Ve
.Sp
Previously, only child processes received stringified values:
.Sp
.Vb 2
\&    my $foo = 1;
\&    $ENV{\*(Aqbar\*(Aq} = \e$foo;
\&
\&    # Always printed \*(Aqnon ref\*(Aq
\&    system($^X, \*(Aq\-e\*(Aq,
\&           q/print ( ref $ENV{\*(Aqbar\*(Aq}  ? \*(Aqref\*(Aq : \*(Aqnon ref\*(Aq ) /);
.Ve
.Sp
This happens because you can't really share arbitrary data structures with
foreign processes.
.ie n .IP "$OLD_PERL_VERSION" 8
.el .IP "\f(CW$OLD_PERL_VERSION\fR" 8
.IX Item "$OLD_PERL_VERSION"
.PD 0
.IP "$]" 8
.IX Xref "$] $OLD_PERL_VERSION"
.PD
The revision, version, and subversion of the Perl interpreter, represented
as a decimal of the form 5.XXXYYY, where \s-1XXX\s0 is the version / 1e3 and \s-1YYY\s0
is the subversion / 1e6.  For example, Perl v5.10.1 would be \*(L"5.010001\*(R".
.Sp
This variable can be used to determine whether the Perl interpreter
executing a script is in the right range of versions:
.Sp
.Vb 1
\&    warn "No PerlIO!\en" if $] lt \*(Aq5.008\*(Aq;
.Ve
.Sp
When comparing \f(CW$]\fR, string comparison operators are \fBhighly
recommended\fR.  The inherent limitations of binary floating point
representation can sometimes lead to incorrect comparisons for some
numbers on some architectures.
.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
See \*(L"$^V\*(R" for a representation of the Perl version as a version
object, which allows more flexible string comparisons.
.Sp
The main advantage of \f(CW$]\fR over \f(CW$^V\fR is that it works the same on any
version of Perl.  The disadvantages are that it can't easily be compared
to versions in other formats (e.g. literal v\-strings, \*(L"v1.2.3\*(R" or
version objects) and numeric comparisons can occasionally fail; it's good
for string literal version checks and bad for comparing to a variable
that hasn't been sanity-checked.
.Sp
The \f(CW$OLD_PERL_VERSION\fR form was added in Perl v5.20.0 for historical
reasons but its use is discouraged. (If your reason to use \f(CW$]\fR is to
run code on old perls then referring to it as \f(CW$OLD_PERL_VERSION\fR would
be self-defeating.)
.Sp
Mnemonic: Is this version of perl in the right bracket?
.ie n .IP "$SYSTEM_FD_MAX" 8
.el .IP "\f(CW$SYSTEM_FD_MAX\fR" 8
.IX Item "$SYSTEM_FD_MAX"
.PD 0
.IP "$^F" 8
.IX Xref "$^F $SYSTEM_FD_MAX"
.IX Item "$^F"
.PD
The maximum system file descriptor, ordinarily 2.  System file
descriptors are passed to \f(CW\*(C`exec()\*(C'\fRed processes, while higher file
descriptors are not.  Also, during an
\&\f(CW\*(C`open()\*(C'\fR, system file descriptors are
preserved even if the \f(CW\*(C`open()\*(C'\fR fails (ordinary file descriptors are
closed before the \f(CW\*(C`open()\*(C'\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 \f(CW\*(C`exec()\*(C'\fR.
.ie n .IP "@F" 8
.el .IP "\f(CW@F\fR" 8
.IX Xref "@F"
.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 \*(Aqvars\*(Aq\*(C'\fR.
.ie n .IP "@INC" 8
.el .IP "\f(CW@INC\fR" 8
.IX Xref "@INC"
.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.
Prior to Perl 5.26, \f(CW\*(C`.\*(C'\fR \-which represents the current directory, was included
in \f(CW@INC\fR; it has been removed. This change in behavior is documented
in \f(CW\*(C`PERL_USE_UNSAFE_INC\*(C'\fR and it is
not recommended that \f(CW\*(C`.\*(C'\fR be re-added to \f(CW@INC\fR.
If you need to modify \f(CW@INC\fR at runtime, you should use the \f(CW\*(C`use lib\*(C'\fR pragma
to get the machine-dependent library properly loaded as well:
.Sp
.Vb 2
\&    use lib \*(Aq/mypath/libdir/\*(Aq;
\&    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.
.ie n .IP "%INC" 8
.el .IP "\f(CW%INC\fR" 8
.IX Xref "%INC"
.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.
.ie n .IP "$INPLACE_EDIT" 8
.el .IP "\f(CW$INPLACE_EDIT\fR" 8
.IX Item "$INPLACE_EDIT"
.PD 0
.IP "$^I" 8
.IX Xref "$^I $INPLACE_EDIT"
.IX Item "$^I"
.PD
The current value of the inplace-edit extension.  Use \f(CW\*(C`undef\*(C'\fR to disable
inplace editing.
.Sp
Mnemonic: value of \fB\-i\fR switch.
.ie n .IP "@ISA" 8
.el .IP "\f(CW@ISA\fR" 8
.IX Xref "@ISA"
.IX Item "@ISA"
Each package contains a special array called \f(CW@ISA\fR which contains a list
of that class's parent classes, if any. This array is simply a list of
scalars, each of which is a string that corresponds to a package name. The
array is examined when Perl does method resolution, which is covered in
perlobj.
.Sp
To load packages while adding them to \f(CW@ISA\fR, see the parent pragma. The
discouraged base pragma does this as well, but should not be used except
when compatibility with the discouraged fields pragma is required.
.IP "$^M" 8
.IX Xref "$^M"
.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 \f(CW\*(C`die()\*(C'\fRing.  Suppose that your Perl
were compiled with \f(CW\*(C`\-DPERL_EMERGENCY_SBRK\*(C'\fR and used Perl's malloc.
Then
.Sp
.Vb 1
\&    $^M = \*(Aqa\*(Aq 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
add custom C compilation flags when compiling perl.  To discourage casual
use of this advanced feature, there is no English long name for
this variable.
.Sp
This variable was added in Perl 5.004.
.ie n .IP "$OSNAME" 8
.el .IP "\f(CW$OSNAME\fR" 8
.IX Item "$OSNAME"
.PD 0
.IP "$^O" 8
.IX Xref "$^O $OSNAME"
.IX Item "$^O"
.PD
The name of the operating system under which this copy of Perl was
built, as determined during the configuration process.  For examples
see \*(L"\s-1PLATFORMS\*(R"\s0 in perlport.
.Sp
The value is identical to \f(CW$Config{\*(Aqosname\*(Aq}\fR.  See also Config
and the \fB\-V\fR command-line switch documented in perlrun.
.Sp
In Windows platforms, \f(CW$^O\fR 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 \f(CW\*(C`Win32::GetOSName()\*(C'\fR or
\&\fBWin32::GetOSVersion()\fR (see Win32 and perlport) to distinguish
between the variants.
.Sp
This variable was added in Perl 5.003.
.ie n .IP "%SIG" 8
.el .IP "\f(CW%SIG\fR" 8
.IX Xref "%SIG"
.IX Item "%SIG"
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);
\&        }
\&
\&    $SIG{\*(AqINT\*(Aq}  = \e&handler;
\&    $SIG{\*(AqQUIT\*(Aq} = \e&handler;
\&    ...
\&    $SIG{\*(AqINT\*(Aq}  = \*(AqDEFAULT\*(Aq;   # restore default action
\&    $SIG{\*(AqQUIT\*(Aq} = \*(AqIGNORE\*(Aq;    # ignore SIGQUIT
.Ve
.Sp
Using a value of \f(CW\*(AqIGNORE\*(Aq\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 7
\&    $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 \f(CW\*(C`sigaction()\*(C'\fR function then signal handlers
are installed using it.  This means you get reliable signal handling.
.Sp
The default delivery policy of signals changed in Perl v5.8.0 from
immediate (also known as \*(L"unsafe\*(R") to deferred, also known as \*(L"safe
signals\*(R".  See perlipc for more information.
.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 \f(CW\*(C`_\|_WARN_\|_\*(C'\fR hook causes the
ordinary printing of warnings to \f(CW\*(C`STDERR\*(C'\fR 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
As the \f(CW\*(AqIGNORE\*(Aq\fR hook is not supported by \f(CW\*(C`_\|_WARN_\|_\*(C'\fR, you can
disable warnings using the empty subroutine:
.Sp
.Vb 1
\&    local $SIG{_\|_WARN_\|_} = sub {};
.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 \f(CW\*(C`_\|_DIE_\|_\*(C'\fR 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 &sub\*(C'\fR, a loop exit,
or a \f(CW\*(C`die()\*(C'\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
The \f(CW$SIG{_\|_DIE_\|_}\fR hook is called even inside an \f(CW\*(C`eval()\*(C'\fR. It was
never intended to happen this way, but an implementation glitch made
this possible. This used to be deprecated, as it allowed strange action
at a distance like rewriting a pending exception in \f(CW$@\fR. Plans to
rectify this have been scrapped, as users found that rewriting a 
pending exception is actually a useful feature, and not a bug.
.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 5
\&    require Carp if defined $^S;
\&    Carp::confess("Something wrong") if defined &Carp::confess;
\&    die "Something wrong, but could not load Carp to give "
\&      . "backtrace...\en\et"
\&      . "To see backtrace try starting Perl with \-MCarp switch";
.Ve
.Sp
Here the first line will load \f(CW\*(C`Carp\*(C'\fR \fIunless\fR it is the parser who
called the handler.  The second line will print backtrace and die if
\&\f(CW\*(C`Carp\*(C'\fR was available.  The third line will be executed only if \f(CW\*(C`Carp\*(C'\fR was
not available.
.Sp
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.
.Sp
See \*(L"die\*(R" in perlfunc, \*(L"warn\*(R" in perlfunc, \*(L"eval\*(R" in perlfunc, and
warnings for additional information.
.ie n .IP "$BASETIME" 8
.el .IP "\f(CW$BASETIME\fR" 8
.IX Item "$BASETIME"
.PD 0
.IP "$^T" 8
.IX Xref "$^T $BASETIME"
.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.
.ie n .IP "$PERL_VERSION" 8
.el .IP "\f(CW$PERL_VERSION\fR" 8
.IX Item "$PERL_VERSION"
.PD 0
.IP "$^V" 8
.IX Xref "$^V $PERL_VERSION"
.IX Item "$^V"
.PD
The revision, version, and subversion of the Perl interpreter,
represented as a version object.
.Sp
This variable first appeared in perl v5.6.0; earlier versions of perl
will see an undefined value.  Before perl v5.10.0 \f(CW$^V\fR was represented
as a v\-string rather than a version object.
.Sp
\&\f(CW$^V\fR can be used to determine whether the Perl interpreter executing
a script is in the right range of versions.  For example:
.Sp
.Vb 1
\&    warn "Hashes not randomized!\en" if !$^V or $^V lt v5.8.1
.Ve
.Sp
While version objects overload stringification, to portably convert
\&\f(CW$^V\fR into its string representation, use \f(CW\*(C`sprintf()\*(C'\fR's \f(CW"%vd"\fR
conversion, which works for both v\-strings or version objects:
.Sp
.Vb 1
\&    printf "version is v%vd\en", $^V;  # Perl\*(Aqs 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 a decimal representation of the Perl version.
.Sp
The main advantage of \f(CW$^V\fR over \f(CW$]\fR is that, for Perl v5.10.0 or
later, it overloads operators, allowing easy comparison against other
version representations (e.g. decimal, literal v\-string, \*(L"v1.2.3\*(R", or
objects).  The disadvantage is that prior to v5.10.0, it was only a
literal v\-string, which can't be easily printed or compared, whereas
the behavior of \f(CW$]\fR is unchanged on all versions of Perl.
.Sp
Mnemonic: use ^V for a version object.
.IP "${^WIN32_SLOPPY_STAT}" 8
.IX Xref "${^WIN32_SLOPPY_STAT} sitecustomize sitecustomize.pl"
.IX Item "${^WIN32_SLOPPY_STAT}"
If this variable is set to a true value, then \f(CW\*(C`stat()\*(C'\fR on Windows will
not try to open the file.  This means that the link count cannot be
determined and file attributes may be out of date if additional
hardlinks to the file exist.  On the other hand, not opening the file
is considerably faster, especially for files on network drives.
.Sp
This variable could be set in the \fIsitecustomize.pl\fR file to
configure the local Perl installation to use \*(L"sloppy\*(R" \f(CW\*(C`stat()\*(C'\fR by
default.  See the documentation for \fB\-f\fR in
perlrun for more information about site
customization.
.Sp
This variable was added in Perl v5.10.0.
.ie n .IP "$EXECUTABLE_NAME" 8
.el .IP "\f(CW$EXECUTABLE_NAME\fR" 8
.IX Item "$EXECUTABLE_NAME"
.PD 0
.IP "$^X" 8
.IX Xref "$^X $EXECUTABLE_NAME"
.IX Item "$^X"
.PD
The name used to execute the current copy of Perl, from C's
\&\f(CW\*(C`argv[0]\*(C'\fR or (where supported) \fI/proc/self/exe\fR.
.Sp
Depending on the host operating system, the value of \f(CW$^X\fR 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 \f(CW$^X\fR 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 \f(CW$^X\fR 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 \f(CW$^X\fR 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 \f(CW$^X\fR to a path name, use the
following statements:
.Sp
.Vb 7
\&    # Build up a set of file names (not command names).
\&    use Config;
\&    my $this_perl = $^X;
\&    if ($^O ne \*(AqVMS\*(Aq) {
\&        $this_perl .= $Config{_exe}
\&          unless $this_perl =~ m/$Config{_exe}$/i;
\&        }
.Ve
.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 \f(CW$^X\fR.  The following statements accomplish
this goal, and produce a pathname that can be invoked as a
command or referenced as a file.
.Sp
.Vb 6
\&    use Config;
\&    my $secure_perl_path = $Config{perlpath};
\&    if ($^O ne \*(AqVMS\*(Aq) {
\&        $secure_perl_path .= $Config{_exe}
\&            unless $secure_perl_path =~ m/$Config{_exe}$/i;
\&        }
.Ve
.SS "Variables related to regular expressions"
.IX Subsection "Variables related to regular expressions"
Most of the special variables related to regular expressions are side
effects.  Perl sets these variables when it has a successful match, so
you should check the match result before using them.  For instance:
.PP
.Vb 3
\&    if( /P(A)TT(ER)N/ ) {
\&        print "I found $1 and $2\en";
\&        }
.Ve
.PP
These variables are read-only and dynamically-scoped, unless we note
otherwise.
.PP
The dynamic nature of the regular expression variables means that
their value is limited to the block that they are in, as demonstrated
by this bit of code:
.PP
.Vb 2
\&    my $outer = \*(AqWallace and Grommit\*(Aq;
\&    my $inner = \*(AqMutt and Jeff\*(Aq;
\&
\&    my $pattern = qr/(\eS+) and (\eS+)/;
\&
\&    sub show_n { print "\e$1 is $1; \e$2 is $2\en" }
\&
\&    {
\&    OUTER:
\&        show_n() if $outer =~ m/$pattern/;
\&
\&        INNER: {
\&            show_n() if $inner =~ m/$pattern/;
\&            }
\&
\&        show_n();
\&    }
.Ve
.PP
The output shows that while in the \f(CW\*(C`OUTER\*(C'\fR block, the values of \f(CW$1\fR
and \f(CW$2\fR are from the match against \f(CW$outer\fR.  Inside the \f(CW\*(C`INNER\*(C'\fR
block, the values of \f(CW$1\fR and \f(CW$2\fR are from the match against
\&\f(CW$inner\fR, but only until the end of the block (i.e. the dynamic
scope).  After the \f(CW\*(C`INNER\*(C'\fR block completes, the values of \f(CW$1\fR and
\&\f(CW$2\fR return to the values for the match against \f(CW$outer\fR even though
we have not made another match:
.PP
.Vb 3
\&    $1 is Wallace; $2 is Grommit
\&    $1 is Mutt; $2 is Jeff
\&    $1 is Wallace; $2 is Grommit
.Ve
.PP
\fIPerformance issues\fR
.IX Subsection "Performance issues"
.PP
Traditionally in Perl, any use of any of the three variables  \f(CW\*(C`$\`\*(C'\fR, \f(CW$&\fR
or \f(CW\*(C`$\*(Aq\*(C'\fR (or their \f(CW\*(C`use English\*(C'\fR equivalents) anywhere in the code, caused
all subsequent successful pattern matches to make a copy of the matched
string, in case the code might subsequently access one of those variables.
This imposed a considerable performance penalty across the whole program,
so generally the use of these variables has been discouraged.
.PP
In Perl 5.6.0 the \f(CW\*(C`@\-\*(C'\fR and \f(CW\*(C`@+\*(C'\fR dynamic arrays were introduced that
supply the indices of successful matches. So you could for example do
this:
.PP
.Vb 1
\&    $str =~ /pattern/;
\&
\&    print $\`, $&, $\*(Aq; # bad: performance hit
\&
\&    print             # good: no performance hit
\&        substr($str, 0,     $\-[0]),
\&        substr($str, $\-[0], $+[0]\-$\-[0]),
\&        substr($str, $+[0]);
.Ve
.PP
In Perl 5.10.0 the \f(CW\*(C`/p\*(C'\fR match operator flag and the \f(CW\*(C`${^PREMATCH}\*(C'\fR,
\&\f(CW\*(C`${^MATCH}\*(C'\fR, and \f(CW\*(C`${^POSTMATCH}\*(C'\fR variables were introduced, that allowed
you to suffer the penalties only on patterns marked with \f(CW\*(C`/p\*(C'\fR.
.PP
In Perl 5.18.0 onwards, perl started noting the presence of each of the
three variables separately, and only copied that part of the string
required; so in
.PP
.Vb 1
\&    $\`; $&; "abcdefgh" =~ /d/
.Ve
.PP
perl would only copy the \*(L"abcd\*(R" part of the string. That could make a big
difference in something like
.PP
.Vb 3
\&    $str = \*(Aqx\*(Aq x 1_000_000;
\&    $&; # whoops
\&    $str =~ /x/g # one char copied a million times, not a million chars
.Ve
.PP
In Perl 5.20.0 a new copy-on-write system was enabled by default, which
finally fixes all performance issues with these three variables, and makes
them safe to use anywhere.
.PP
The \f(CW\*(C`Devel::NYTProf\*(C'\fR and \f(CW\*(C`Devel::FindAmpersand\*(C'\fR modules can help you
find uses of these problematic match variables in your code.
.ie n .IP "$<\fIdigits\fR> ($1, $2, ...)" 8
.el .IP "$<\fIdigits\fR> ($1, \f(CW$2\fR, ...)" 8
.IX Xref "$1 $2 $3 $\\f(ISdigits\\f(IE"
.IX Item "$<digits> ($1, $2, ...)"
Contains the subpattern from the corresponding set of capturing
parentheses from the last successful pattern match, not counting patterns
matched in nested blocks that have been exited already.
.Sp
Note there is a distinction between a capture buffer which matches
the empty string a capture buffer which is optional. Eg, \f(CW\*(C`(x?)\*(C'\fR and
\&\f(CW\*(C`(x)?\*(C'\fR The latter may be undef, the former not.
.Sp
These variables are read-only and dynamically-scoped.
.Sp
Mnemonic: like \edigits.
.IP "@{^CAPTURE}" 8
.IX Xref "@{^CAPTURE} @^CAPTURE"
.IX Item "@{^CAPTURE}"
An array which exposes the contents of the capture buffers, if any, of
the last successful pattern match, not counting patterns matched
in nested blocks that have been exited already.
.Sp
Note that the 0 index of @{^CAPTURE} is equivalent to \f(CW$1\fR, the 1 index
is equivalent to \f(CW$2\fR, etc.
.Sp
.Vb 3
\&    if ("foal"=~/(.)(.)(.)(.)/) {
\&        print join "\-", @{^CAPTURE};
\&    }
.Ve
.Sp
should output \*(L"f\-o-a-l\*(R".
.Sp
See also "$<\fIdigits\fR> ($1, \f(CW$2\fR, ...)", \*(L"%{^CAPTURE}\*(R" and
\&\*(L"%{^CAPTURE_ALL}\*(R".
.Sp
Note that unlike most other regex magic variables there is no single
letter equivalent to \f(CW\*(C`@{^CAPTURE}\*(C'\fR.
.Sp
This variable was added in 5.25.7
.ie n .IP "$MATCH" 8
.el .IP "\f(CW$MATCH\fR" 8
.IX Item "$MATCH"
.PD 0
.IP "$&" 8
.IX Xref "$& $MATCH"
.PD
The string matched by the last successful pattern match (not counting
any matches hidden within a \s-1BLOCK\s0 or \f(CW\*(C`eval()\*(C'\fR enclosed by the current
\&\s-1BLOCK\s0).
.Sp
See \*(L"Performance issues\*(R" above for the serious performance implications
of using this variable (even once) in your code.
.Sp
This variable is read-only and dynamically-scoped.
.Sp
Mnemonic: like \f(CW\*(C`&\*(C'\fR in some editors.
.IP "${^MATCH}" 8
.IX Xref "${^MATCH}"
.IX Item "${^MATCH}"
This is similar to \f(CW$&\fR (\f(CW$MATCH\fR) except that it does not incur the
performance penalty associated with that variable.
.Sp
See \*(L"Performance issues\*(R" above.
.Sp
In Perl v5.18 and earlier, it is only guaranteed
to return a defined value when the pattern was compiled or executed with
the \f(CW\*(C`/p\*(C'\fR modifier.  In Perl v5.20, the \f(CW\*(C`/p\*(C'\fR modifier does nothing, so
\&\f(CW\*(C`${^MATCH}\*(C'\fR does the same thing as \f(CW$MATCH\fR.
.Sp
This variable was added in Perl v5.10.0.
.Sp
This variable is read-only and dynamically-scoped.
.ie n .IP "$PREMATCH" 8
.el .IP "\f(CW$PREMATCH\fR" 8
.IX Item "$PREMATCH"
.PD 0
.IP "$`" 8
.IX Xref "$` $PREMATCH ${^PREMATCH}"
.PD
The string preceding whatever was matched by the last successful
pattern match, not counting any matches hidden within a \s-1BLOCK\s0 or \f(CW\*(C`eval\*(C'\fR
enclosed by the current \s-1BLOCK.\s0
.Sp
See \*(L"Performance issues\*(R" above for the serious performance implications
of using this variable (even once) in your code.
.Sp
This variable is read-only and dynamically-scoped.
.Sp
Mnemonic: \f(CW\*(C`\`\*(C'\fR often precedes a quoted string.
.IP "${^PREMATCH}" 8
.IX Xref "$` ${^PREMATCH}"
.IX Item "${^PREMATCH}"
This is similar to \f(CW\*(C`$\`\*(C'\fR ($PREMATCH) except that it does not incur the
performance penalty associated with that variable.
.Sp
See \*(L"Performance issues\*(R" above.
.Sp
In Perl v5.18 and earlier, it is only guaranteed
to return a defined value when the pattern was compiled or executed with
the \f(CW\*(C`/p\*(C'\fR modifier.  In Perl v5.20, the \f(CW\*(C`/p\*(C'\fR modifier does nothing, so
\&\f(CW\*(C`${^PREMATCH}\*(C'\fR does the same thing as \f(CW$PREMATCH\fR.
.Sp
This variable was added in Perl v5.10.0.
.Sp
This variable is read-only and dynamically-scoped.
.ie n .IP "$POSTMATCH" 8
.el .IP "\f(CW$POSTMATCH\fR" 8
.IX Item "$POSTMATCH"
.PD 0
.IP "$'" 8
.IX Xref "$' $POSTMATCH ${^POSTMATCH} @-"
.PD
The string following whatever was matched by the last successful
pattern match (not counting any matches hidden within a \s-1BLOCK\s0 or \f(CW\*(C`eval()\*(C'\fR
enclosed by the current \s-1BLOCK\s0).  Example:
.Sp
.Vb 3
\&    local $_ = \*(Aqabcdefghi\*(Aq;
\&    /def/;
\&    print "$\`:$&:$\*(Aq\en";         # prints abc:def:ghi
.Ve
.Sp
See \*(L"Performance issues\*(R" above for the serious performance implications
of using this variable (even once) in your code.
.Sp
This variable is read-only and dynamically-scoped.
.Sp
Mnemonic: \f(CW\*(C`\*(Aq\*(C'\fR often follows a quoted string.
.IP "${^POSTMATCH}" 8
.IX Xref "${^POSTMATCH} $' $POSTMATCH"
.IX Item "${^POSTMATCH}"
This is similar to \f(CW\*(C`$\*(Aq\*(C'\fR (\f(CW$POSTMATCH\fR) except that it does not incur the
performance penalty associated with that variable.
.Sp
See \*(L"Performance issues\*(R" above.
.Sp
In Perl v5.18 and earlier, it is only guaranteed
to return a defined value when the pattern was compiled or executed with
the \f(CW\*(C`/p\*(C'\fR modifier.  In Perl v5.20, the \f(CW\*(C`/p\*(C'\fR modifier does nothing, so
\&\f(CW\*(C`${^POSTMATCH}\*(C'\fR does the same thing as \f(CW$POSTMATCH\fR.
.Sp
This variable was added in Perl v5.10.0.
.Sp
This variable is read-only and dynamically-scoped.
.ie n .IP "$LAST_PAREN_MATCH" 8
.el .IP "\f(CW$LAST_PAREN_MATCH\fR" 8
.IX Item "$LAST_PAREN_MATCH"
.PD 0
.IP "$+" 8
.IX Xref "$+ $LAST_PAREN_MATCH"
.PD
The text matched by the highest used capture group of the last
successful search pattern.  It is logically equivalent to the highest
numbered capture variable (\f(CW$1\fR, \f(CW$2\fR, ...) which has a defined value.
.Sp
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
This variable is read-only and dynamically-scoped.
.Sp
Mnemonic: be positive and forward looking.
.ie n .IP "$LAST_SUBMATCH_RESULT" 8
.el .IP "\f(CW$LAST_SUBMATCH_RESULT\fR" 8
.IX Item "$LAST_SUBMATCH_RESULT"
.PD 0
.IP "$^N" 8
.IX Xref "$^N $LAST_SUBMATCH_RESULT"
.IX Item "$^N"
.PD
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. This is subtly different from \f(CW$+\fR. For example in
.Sp
.Vb 1
\&    "ab" =~ /^((.)(.))$/
.Ve
.Sp
we have
.Sp
.Vb 3
\&    $1,$^N   have the value "ab"
\&    $2       has  the value "a"
\&    $3,$+    have the value "b"
.Ve
.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 was added in Perl v5.8.0.
.Sp
Mnemonic: the (possibly) Nested parenthesis that most recently closed.
.ie n .IP "@LAST_MATCH_END" 8
.el .IP "\f(CW@LAST_MATCH_END\fR" 8
.IX Item "@LAST_MATCH_END"
.PD 0
.IP "@+" 8
.IX Xref "@+ @LAST_MATCH_END"
.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.
.Sp
This variable was added in Perl v5.6.0.
.IP "%{^CAPTURE}" 8
.IX Item "%{^CAPTURE}"
.PD 0
.ie n .IP "%LAST_PAREN_MATCH" 8
.el .IP "\f(CW%LAST_PAREN_MATCH\fR" 8
.IX Item "%LAST_PAREN_MATCH"
.IP "%+" 8
.IX Xref "%+ %LAST_PAREN_MATCH %{^CAPTURE}"
.PD
Similar to \f(CW\*(C`@+\*(C'\fR, the \f(CW\*(C`%+\*(C'\fR hash allows access to the named capture
buffers, should they exist, in the last successful match in the
currently active dynamic scope.
.Sp
For example, \f(CW$+{foo}\fR is equivalent to \f(CW$1\fR after the following match:
.Sp
.Vb 1
\&    \*(Aqfoo\*(Aq =~ /(?<foo>foo)/;
.Ve
.Sp
The keys of the \f(CW\*(C`%+\*(C'\fR hash list only the names of buffers that have
captured (and that are thus associated to defined values).
.Sp
If multiple distinct capture groups have the same name, then
\&\f(CW$+{NAME}\fR will refer to the leftmost defined group in the match.
.Sp
The underlying behaviour of \f(CW\*(C`%+\*(C'\fR is provided by the
Tie::Hash::NamedCapture module.
.Sp
\&\fBNote:\fR \f(CW\*(C`%\-\*(C'\fR and \f(CW\*(C`%+\*(C'\fR are tied views into a common internal hash
associated with the last successful regular expression.  Therefore mixing
iterative access to them via \f(CW\*(C`each\*(C'\fR may have unpredictable results.
Likewise, if the last successful match changes, then the results may be
surprising.
.Sp
This variable was added in Perl v5.10.0. The \f(CW\*(C`%{^CAPTURE}\*(C'\fR alias was
added in 5.25.7.
.Sp
This variable is read-only and dynamically-scoped.
.ie n .IP "@LAST_MATCH_START" 8
.el .IP "\f(CW@LAST_MATCH_START\fR" 8
.IX Item "@LAST_MATCH_START"
.PD 0
.IP "@\-" 8
.IX Xref "@- @LAST_MATCH_START"
.PD
\&\f(CW\*(C`$\-[0]\*(C'\fR is the offset of the start of the last successful match.
\&\f(CW\*(C`$\-[\f(CIn\f(CW]\*(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, \f(CW$&\fR coincides with \f(CW\*(C`substr $_, $\-[0],
$+[0] \- $\-[0]\*(C'\fR.  Similarly, $\fIn\fR coincides with \f(CW\*(C`substr $_, $\-[n],
$+[n] \- $\-[n]\*(C'\fR if \f(CW\*(C`$\-[n]\*(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 """$\`"" is the same as ""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 "$& is the same as ""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 """$\*(Aq"" is the same as ""substr($var, $+[0])""" 5
.el .IP "\f(CW$\*(Aq\fR is the same as \f(CWsubstr($var, $+[0])\fR" 5
.IX Item "$ is the same as substr($var, $+[0])"
.ie n .IP "$1 is the same as ""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 is the same as ""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 is the same as ""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
.PD
.Sp
This variable was added in Perl v5.6.0.
.RE
.IP "%{^CAPTURE_ALL}" 8
.IX Xref "%{^CAPTURE_ALL}"
.IX Item "%{^CAPTURE_ALL}"
.PD 0
.IP "%\-" 8
.IX Xref "%-"
.PD
Similar to \f(CW\*(C`%+\*(C'\fR, this variable allows access to the named capture groups
in the last successful match in the currently active dynamic scope.  To
each capture group name found in the regular expression, it associates a
reference to an array containing the list of values captured by all
buffers with that name (should there be several of them), in the order
where they appear.
.Sp
Here's an example:
.Sp
.Vb 12
\&    if (\*(Aq1234\*(Aq =~ /(?<A>1)(?<B>2)(?<A>3)(?<B>4)/) {
\&        foreach my $bufname (sort keys %\-) {
\&            my $ary = $\-{$bufname};
\&            foreach my $idx (0..$#$ary) {
\&                print "\e$\-{$bufname}[$idx] : ",
\&                      (defined($ary\->[$idx])
\&                          ? "\*(Aq$ary\->[$idx]\*(Aq"
\&                          : "undef"),
\&                      "\en";
\&            }
\&        }
\&    }
.Ve
.Sp
would print out:
.Sp
.Vb 4
\&    $\-{A}[0] : \*(Aq1\*(Aq
\&    $\-{A}[1] : \*(Aq3\*(Aq
\&    $\-{B}[0] : \*(Aq2\*(Aq
\&    $\-{B}[1] : \*(Aq4\*(Aq
.Ve
.Sp
The keys of the \f(CW\*(C`%\-\*(C'\fR hash correspond to all buffer names found in
the regular expression.
.Sp
The behaviour of \f(CW\*(C`%\-\*(C'\fR is implemented via the
Tie::Hash::NamedCapture module.
.Sp
\&\fBNote:\fR \f(CW\*(C`%\-\*(C'\fR and \f(CW\*(C`%+\*(C'\fR are tied views into a common internal hash
associated with the last successful regular expression.  Therefore mixing
iterative access to them via \f(CW\*(C`each\*(C'\fR may have unpredictable results.
Likewise, if the last successful match changes, then the results may be
surprising.
.Sp
This variable was added in Perl v5.10.0. The \f(CW\*(C`%{^CAPTURE_ALL}\*(C'\fR alias was
added in 5.25.7.
.Sp
This variable is read-only and dynamically-scoped.
.ie n .IP "$LAST_REGEXP_CODE_RESULT" 8
.el .IP "\f(CW$LAST_REGEXP_CODE_RESULT\fR" 8
.IX Item "$LAST_REGEXP_CODE_RESULT"
.PD 0
.IP "$^R" 8
.IX Xref "$^R $LAST_REGEXP_CODE_RESULT"
.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.
.Sp
This variable was added in Perl 5.005.
.IP "${^RE_COMPILE_RECURSION_LIMIT}" 8
.IX Xref "${^RE_COMPILE_RECURSION_LIMIT}"
.IX Item "${^RE_COMPILE_RECURSION_LIMIT}"
The current value giving the maximum number of open but unclosed
parenthetical groups there may be at any point during a regular
expression compilation.  The default is currently 1000 nested groups.
You may adjust it depending on your needs and the amount of memory
available.
.Sp
This variable was added in Perl v5.30.0.
.IP "${^RE_DEBUG_FLAGS}" 8
.IX Xref "${^RE_DEBUG_FLAGS}"
.IX Item "${^RE_DEBUG_FLAGS}"
The current value of the regex debugging flags.  Set to 0 for no debug output
even when the \f(CW\*(C`re \*(Aqdebug\*(Aq\*(C'\fR module is loaded.  See re for details.
.Sp
This variable was added in Perl v5.10.0.
.IP "${^RE_TRIE_MAXBUF}" 8
.IX Xref "${^RE_TRIE_MAXBUF}"
.IX Item "${^RE_TRIE_MAXBUF}"
Controls how certain regex optimisations are applied and how much memory they
utilize.  This value by default is 65536 which corresponds to a 512kB
temporary cache.  Set this to a higher value to trade
memory for speed when matching large alternations.  Set
it to a lower value if you want the optimisations to
be as conservative of memory as possible but still occur, and set it to a
negative value to prevent the optimisation and conserve the most memory.
Under normal situations this variable should be of no interest to you.
.Sp
This variable was added in Perl v5.10.0.
.SS "Variables related to filehandles"
.IX Subsection "Variables related to filehandles"
Variables that depend on the currently selected filehandle may be set
by calling an appropriate object method on the \f(CW\*(C`IO::Handle\*(C'\fR 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 \f(CW\*(C`IO::Handle\*(C'\fR attribute.  The
methods each take an optional \s-1EXPR,\s0 which, if supplied, specifies the
new value for the \f(CW\*(C`IO::Handle\*(C'\fR attribute in question.  If not
supplied, most methods do nothing to the current value\*(--except for
\&\f(CW\*(C`autoflush()\*(C'\fR, which will assume a 1 for you, just to be different.
.PP
Because loading in the \f(CW\*(C`IO::Handle\*(C'\fR 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 = \*(Aq\*(Aq;
\&    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 5
\&    for ( 1..3 ){
\&        $\e = "\er\en";
\&        nasty_break();
\&        print "$_";
\&    }
\&
\&    sub nasty_break {
\&        $\e = "\ef";
\&        # do something with $_
\&    }
.Ve
.PP
You probably expect this code to print the equivalent of
.PP
.Vb 1
\&    "1\er\en2\er\en3\er\en"
.Ve
.PP
but instead you get:
.PP
.Vb 1
\&    "1\ef2\ef3\ef"
.Ve
.PP
Why? Because \f(CW\*(C`nasty_break()\*(C'\fR modifies \f(CW\*(C`$\e\*(C'\fR without localizing it
first.  The value you set in  \f(CW\*(C`nasty_break()\*(C'\fR is still there when you
return.  The fix is to add \f(CW\*(C`local()\*(C'\fR so the value doesn't leak out of
\&\f(CW\*(C`nasty_break()\*(C'\fR:
.PP
.Vb 1
\&    local $\e = "\ef";
.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.
.ie n .IP "$ARGV" 8
.el .IP "\f(CW$ARGV\fR" 8
.IX Xref "$ARGV"
.IX Item "$ARGV"
Contains the name of the current file when reading from \f(CW\*(C`<>\*(C'\fR.
.ie n .IP "@ARGV" 8
.el .IP "\f(CW@ARGV\fR" 8
.IX Xref "@ARGV"
.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 \*(L"$0\*(R" for the command name.
.IP "\s-1ARGV\s0" 8
.IX Xref "ARGV"
.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 "\s-1ARGVOUT\s0" 8
.IX Xref "ARGVOUT"
.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 "IO::Handle\->output_field_separator( \s-1EXPR\s0 )" 8
.IX Item "IO::Handle->output_field_separator( EXPR )"
.PD 0
.ie n .IP "$OUTPUT_FIELD_SEPARATOR" 8
.el .IP "\f(CW$OUTPUT_FIELD_SEPARATOR\fR" 8
.IX Item "$OUTPUT_FIELD_SEPARATOR"
.ie n .IP "$OFS" 8
.el .IP "\f(CW$OFS\fR" 8
.IX Item "$OFS"
.IP "$," 8
.IX Xref "$, $OFS $OUTPUT_FIELD_SEPARATOR"
.PD
The output field separator for the print operator.  If defined, this
value is printed between each of print's arguments.  Default is \f(CW\*(C`undef\*(C'\fR.
.Sp
You cannot call \f(CW\*(C`output_field_separator()\*(C'\fR on a handle, only as a
static method.  See IO::Handle.
.Sp
Mnemonic: what is printed when there is a \*(L",\*(R" in your print statement.
.IP "\s-1HANDLE\-\s0>input_line_number( \s-1EXPR\s0 )" 8
.IX Item "HANDLE->input_line_number( EXPR )"
.PD 0
.ie n .IP "$INPUT_LINE_NUMBER" 8
.el .IP "\f(CW$INPUT_LINE_NUMBER\fR" 8
.IX Item "$INPUT_LINE_NUMBER"
.ie n .IP "$NR" 8
.el .IP "\f(CW$NR\fR" 8
.IX Item "$NR"
.IP "$." 8
.IX Xref "$. $NR $INPUT_LINE_NUMBER line number"
.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 \f(CW\*(C`readline()\*(C'\fR or \f(CW\*(C`<>\*(C'\fR), or when \f(CW\*(C`tell()\*(C'\fR or
\&\f(CW\*(C`seek()\*(C'\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 \f(CW\*(C`close()\*(C'\fR.  For more
details, see \*(L"I/O Operators\*(R" in perlop.  Because \f(CW\*(C`<>\*(C'\fR never does
an explicit close, line numbers increase across \f(CW\*(C`ARGV\*(C'\fR 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
.ie n .IP "$INPUT_RECORD_SEPARATOR" 8
.el .IP "\f(CW$INPUT_RECORD_SEPARATOR\fR" 8
.IX Item "$INPUT_RECORD_SEPARATOR"
.ie n .IP "$RS" 8
.el .IP "\f(CW$RS\fR" 8
.IX Item "$RS"
.IP "$/" 8
.IX Xref "$ $RS $INPUT_RECORD_SEPARATOR"
.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.
.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 an empty string \*(-- the so-called \fIparagraph mode\fR \*(-- merits
special attention.  When \f(CW$/\fR is set to \f(CW""\fR and the entire file is read in
with that setting, any sequence of consecutive newlines \f(CW"\en\en"\fR at the
beginning of the file is discarded.  With the exception of the final record in
the file, each sequence of characters ending in two or more newlines is
treated as one record and is read in to end in exactly two newlines.  If the
last record in the file ends in zero or one consecutive newlines, that record
is read in with that number of newlines.  If the last record ends in two or
more consecutive newlines, it is read in with two newlines like all preceding
records.
.Sp
Suppose we wrote the following string to a file:
.Sp
.Vb 4
\&    my $string = "\en\en\en";
\&    $string .= "alpha beta\engamma delta\en\en\en";
\&    $string .= "epsilon zeta eta\en\en";
\&    $string .= "theta\en";
\&
\&    my $file = \*(Aqsimple_file.txt\*(Aq; 
\&    open my $OUT, \*(Aq>\*(Aq, $file or die;
\&    print $OUT $string;
\&    close $OUT or die;
.Ve
.Sp
Now we read that file in paragraph mode:
.Sp
.Vb 4
\&    local $/ = ""; # paragraph mode
\&    open my $IN, \*(Aq<\*(Aq, $file or die;
\&    my @records = <$IN>;
\&    close $IN or die;
.Ve
.Sp
\&\f(CW@records\fR will consist of these 3 strings:
.Sp
.Vb 5
\&    (
\&      "alpha beta\engamma delta\en\en",
\&      "epsilon zeta eta\en\en",
\&      "theta\en",
\&    )
.Ve
.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 number of characters.  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 characters from \f(CW$fh\fR.  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.  Trying to set the record
size to zero or less is deprecated and will cause $/ to have the value
of \*(L"undef\*(R", which will cause reading in the (rest of the) whole file.
.Sp
As of 5.19.9 setting \f(CW$/\fR to any other form of reference will throw a
fatal exception. This is in preparation for supporting new ways to set
\&\f(CW$/\fR in the future.
.Sp
On \s-1VMS\s0 only, record reads bypass PerlIO layers and any associated
buffering, so you must not mix record and non-record reads on the
same filehandle.  Record mode mixes with line mode only when the
same buffering layer is in use for both modes.
.Sp
You cannot call \f(CW\*(C`input_record_separator()\*(C'\fR on a handle, only as a
static method.  See IO::Handle.
.Sp
See also \*(L"Newlines\*(R" in perlport.  Also see \*(L"$.\*(R".
.Sp
Mnemonic: / delimits line boundaries when quoting poetry.
.IP "IO::Handle\->output_record_separator( \s-1EXPR\s0 )" 8
.IX Item "IO::Handle->output_record_separator( EXPR )"
.PD 0
.ie n .IP "$OUTPUT_RECORD_SEPARATOR" 8
.el .IP "\f(CW$OUTPUT_RECORD_SEPARATOR\fR" 8
.IX Item "$OUTPUT_RECORD_SEPARATOR"
.ie n .IP "$ORS" 8
.el .IP "\f(CW$ORS\fR" 8
.IX Item "$ORS"
.IP "$\e" 8
.IX Xref "$\\ $ORS $OUTPUT_RECORD_SEPARATOR"
.IX Item "$"
.PD
The output record separator for the print operator.  If defined, this
value is printed after the last of print's arguments.  Default is \f(CW\*(C`undef\*(C'\fR.
.Sp
You cannot call \f(CW\*(C`output_record_separator()\*(C'\fR on a handle, only as a
static method.  See IO::Handle.
.Sp
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 "\s-1HANDLE\-\s0>autoflush( \s-1EXPR\s0 )" 8
.IX Item "HANDLE->autoflush( EXPR )"
.PD 0
.ie n .IP "$OUTPUT_AUTOFLUSH" 8
.el .IP "\f(CW$OUTPUT_AUTOFLUSH\fR" 8
.IX Item "$OUTPUT_AUTOFLUSH"
.IP "$|" 8
.IX Xref "$| autoflush flush $OUTPUT_AUTOFLUSH"
.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.  See \*(L"select\*(R" in perlfunc on
how to select the output channel.  See also IO::Handle.
.Sp
Mnemonic: when you want your pipes to be piping hot.
.IP "${^LAST_FH}" 8
.IX Xref "${^LAST_FH}"
.IX Item "${^LAST_FH}"
This read-only variable contains a reference to the last-read filehandle.
This is set by \f(CW\*(C`<HANDLE>\*(C'\fR, \f(CW\*(C`readline\*(C'\fR, \f(CW\*(C`tell\*(C'\fR, \f(CW\*(C`eof\*(C'\fR and \f(CW\*(C`seek\*(C'\fR.
This is the same handle that \f(CW$.\fR and \f(CW\*(C`tell\*(C'\fR and \f(CW\*(C`eof\*(C'\fR without arguments
use.  It is also the handle used when Perl appends \*(L", <\s-1STDIN\s0> line 1\*(R" to
an error or warning message.
.Sp
This variable was added in Perl v5.18.0.
.PP
\fIVariables related to formats\fR
.IX Subsection "Variables related to formats"
.PP
The special variables for formats are a subset of those for
filehandles.  See perlform for more information about Perl's
formats.
.ie n .IP "$ACCUMULATOR" 8
.el .IP "\f(CW$ACCUMULATOR\fR" 8
.IX Item "$ACCUMULATOR"
.PD 0
.IP "$^A" 8
.IX Xref "$^A $ACCUMULATOR"
.IX Item "$^A"
.PD
The current value of the \f(CW\*(C`write()\*(C'\fR accumulator for \f(CW\*(C`format()\*(C'\fR lines.
A format contains \f(CW\*(C`formline()\*(C'\fR calls that put their result into
\&\f(CW$^A\fR.  After calling its format, \f(CW\*(C`write()\*(C'\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 \f(CW\*(C`formline()\*(C'\fR yourself and then look at it.  See
perlform and \*(L"formline \s-1PICTURE,LIST\*(R"\s0 in perlfunc.
.IP "IO::Handle\->format_formfeed(\s-1EXPR\s0)" 8
.IX Item "IO::Handle->format_formfeed(EXPR)"
.PD 0
.ie n .IP "$FORMAT_FORMFEED" 8
.el .IP "\f(CW$FORMAT_FORMFEED\fR" 8
.IX Item "$FORMAT_FORMFEED"
.IP "$^L" 8
.IX Xref "$^L $FORMAT_FORMFEED"
.IX Item "$^L"
.PD
What formats output as a form feed.  The default is \f(CW\*(C`\ef\*(C'\fR.
.Sp
You cannot call \f(CW\*(C`format_formfeed()\*(C'\fR on a handle, only as a static
method.  See IO::Handle.
.IP "\s-1HANDLE\-\s0>format_page_number(\s-1EXPR\s0)" 8
.IX Item "HANDLE->format_page_number(EXPR)"
.PD 0
.ie n .IP "$FORMAT_PAGE_NUMBER" 8
.el .IP "\f(CW$FORMAT_PAGE_NUMBER\fR" 8
.IX Item "$FORMAT_PAGE_NUMBER"
.IP "$%" 8
.IX Xref "$% $FORMAT_PAGE_NUMBER"
.PD
The current page number of the currently selected output channel.
.Sp
Mnemonic: \f(CW\*(C`%\*(C'\fR is page number in \fBnroff\fR.
.IP "\s-1HANDLE\-\s0>format_lines_left(\s-1EXPR\s0)" 8
.IX Item "HANDLE->format_lines_left(EXPR)"
.PD 0
.ie n .IP "$FORMAT_LINES_LEFT" 8
.el .IP "\f(CW$FORMAT_LINES_LEFT\fR" 8
.IX Item "$FORMAT_LINES_LEFT"
.IP "$\-" 8
.IX Xref "$- $FORMAT_LINES_LEFT"
.PD
The number of lines left on the page of the currently selected output
channel.
.Sp
Mnemonic: lines_on_page \- lines_printed.
.IP "IO::Handle\->format_line_break_characters \s-1EXPR\s0" 8
.IX Item "IO::Handle->format_line_break_characters EXPR"
.PD 0
.ie n .IP "$FORMAT_LINE_BREAK_CHARACTERS" 8
.el .IP "\f(CW$FORMAT_LINE_BREAK_CHARACTERS\fR" 8
.IX Item "$FORMAT_LINE_BREAK_CHARACTERS"
.ie n .IP "$:" 8
.el .IP "\f(CW$:\fR" 8
.IX Xref "$: FORMAT_LINE_BREAK_CHARACTERS"
.IX Item "$:"
.PD
The current set of characters after which a string may be broken to
fill continuation fields (starting with \f(CW\*(C`^\*(C'\fR) in a format.  The default is
\&\*(L"\ \en\-\*(R", to break on a space, newline, or a hyphen.
.Sp
You cannot call \f(CW\*(C`format_line_break_characters()\*(C'\fR on a handle, only as
a static method.  See IO::Handle.
.Sp
Mnemonic: a \*(L"colon\*(R" in poetry is a part of a line.
.IP "\s-1HANDLE\-\s0>format_lines_per_page(\s-1EXPR\s0)" 8
.IX Item "HANDLE->format_lines_per_page(EXPR)"
.PD 0
.ie n .IP "$FORMAT_LINES_PER_PAGE" 8
.el .IP "\f(CW$FORMAT_LINES_PER_PAGE\fR" 8
.IX Item "$FORMAT_LINES_PER_PAGE"
.IP "$=" 8
.IX Xref "$= $FORMAT_LINES_PER_PAGE"
.PD
The current page length (printable lines) of the currently selected
output channel.  The default is 60.
.Sp
Mnemonic: = has horizontal lines.
.IP "\s-1HANDLE\-\s0>format_top_name(\s-1EXPR\s0)" 8
.IX Item "HANDLE->format_top_name(EXPR)"
.PD 0
.ie n .IP "$FORMAT_TOP_NAME" 8
.el .IP "\f(CW$FORMAT_TOP_NAME\fR" 8
.IX Item "$FORMAT_TOP_NAME"
.IP "$^" 8
.IX Xref "$^ $FORMAT_TOP_NAME"
.PD
The name of the current top-of-page format for the currently selected
output channel.  The default is the name of the filehandle with \f(CW\*(C`_TOP\*(C'\fR
appended.  For example, the default format top name for the \f(CW\*(C`STDOUT\*(C'\fR
filehandle is \f(CW\*(C`STDOUT_TOP\*(C'\fR.
.Sp
Mnemonic: points to top of page.
.IP "\s-1HANDLE\-\s0>format_name(\s-1EXPR\s0)" 8
.IX Item "HANDLE->format_name(EXPR)"
.PD 0
.ie n .IP "$FORMAT_NAME" 8
.el .IP "\f(CW$FORMAT_NAME\fR" 8
.IX Item "$FORMAT_NAME"
.IP "$~" 8
.IX Xref "$~ $FORMAT_NAME"
.PD
The name of the current report format for the currently selected
output channel.  The default format name is the same as the filehandle
name.  For example, the default format name for the \f(CW\*(C`STDOUT\*(C'\fR
filehandle is just \f(CW\*(C`STDOUT\*(C'\fR.
.Sp
Mnemonic: brother to \f(CW$^\fR.
.SS "Error Variables"
.IX Xref "error exception"
.IX Subsection "Error Variables"
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.  After
execution of this statement, perl may have set all four special error
variables:
.PP
.Vb 5
\&    eval q{
\&        open my $pipe, "/cdrom/install |" or die $!;
\&        my @res = <$pipe>;
\&        close $pipe or die "bad pipe: $?, $!";
\&    };
.Ve
.PP
When perl executes the \f(CW\*(C`eval()\*(C'\fR expression, it translates the
\&\f(CW\*(C`open()\*(C'\fR, \f(CW\*(C`<PIPE>\*(C'\fR, and \f(CW\*(C`close\*(C'\fR calls in the C run-time library
and thence to the operating system kernel.  perl sets \f(CW$!\fR to
the C library's \f(CW\*(C`errno\*(C'\fR if one of these calls fails.
.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 \f(CW\*(C`die()\*(C'\fRd.  In these cases the
value of \f(CW$@\fR 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
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 a 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 \f(CW\*(C`exit()\*(C'\fR value).
The lower eight bits reflect mode of failure, like signal death and
core dump information.  See \fBwait\fR\|(2) for details.  In contrast to
\&\f(CW$!\fR and \f(CW$^E\fR, which are set only if an 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
\&\f(CW\*(C`eval()\*(C'\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.
.IP "${^CHILD_ERROR_NATIVE}" 8
.IX Xref "$^CHILD_ERROR_NATIVE"
.IX Item "${^CHILD_ERROR_NATIVE}"
The native status returned by the last pipe close, backtick (\f(CW\*(C`\`\`\*(C'\fR)
command, successful call to \f(CW\*(C`wait()\*(C'\fR or \f(CW\*(C`waitpid()\*(C'\fR, or from the
\&\f(CW\*(C`system()\*(C'\fR operator.  On POSIX-like systems this value can be decoded
with the \s-1WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WIFSTOPPED,
WSTOPSIG\s0 and \s-1WIFCONTINUED\s0 functions provided by the \s-1POSIX\s0 module.
.Sp
Under \s-1VMS\s0 this reflects the actual \s-1VMS\s0 exit status; i.e. it is the
same as \f(CW$?\fR when the pragma \f(CW\*(C`use vmsish \*(Aqstatus\*(Aq\*(C'\fR is in effect.
.Sp
This variable was added in Perl v5.10.0.
.ie n .IP "$EXTENDED_OS_ERROR" 8
.el .IP "\f(CW$EXTENDED_OS_ERROR\fR" 8
.IX Item "$EXTENDED_OS_ERROR"
.PD 0
.IP "$^E" 8
.IX Xref "$^E $EXTENDED_OS_ERROR"
.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, OS/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
API\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 C\s0 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.
.Sp
This variable was added in Perl 5.003.
.Sp
Mnemonic: Extra error explanation.
.ie n .IP "$EXCEPTIONS_BEING_CAUGHT" 8
.el .IP "\f(CW$EXCEPTIONS_BEING_CAUGHT\fR" 8
.IX Item "$EXCEPTIONS_BEING_CAUGHT"
.PD 0
.IP "$^S" 8
.IX Xref "$^S $EXCEPTIONS_BEING_CAUGHT"
.IX Item "$^S"
.PD
Current state of the interpreter.
.Sp
.Vb 5
\&        $^S         State
\&        \-\-\-\-\-\-\-\-\-   \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
\&        undef       Parsing module, eval, or main program
\&        true (1)    Executing an eval
\&        false (0)   Otherwise
.Ve
.Sp
The first state may happen in \f(CW$SIG{_\|_DIE_\|_}\fR and \f(CW$SIG{_\|_WARN_\|_}\fR
handlers.
.Sp
The English name \f(CW$EXCEPTIONS_BEING_CAUGHT\fR is slightly misleading, because
the \f(CW\*(C`undef\*(C'\fR value does not indicate whether exceptions are being caught,
since compilation of the main program does not catch exceptions.
.Sp
This variable was added in Perl 5.004.
.ie n .IP "$WARNING" 8
.el .IP "\f(CW$WARNING\fR" 8
.IX Item "$WARNING"
.PD 0
.IP "$^W" 8
.IX Xref "$^W $WARNING"
.IX Item "$^W"
.PD
The current value of the warning switch, initially true if \fB\-w\fR was
used, false otherwise, but directly modifiable.
.Sp
See also warnings.
.Sp
Mnemonic: related to the \fB\-w\fR switch.
.IP "${^WARNING_BITS}" 8
.IX Xref "${^WARNING_BITS}"
.IX Item "${^WARNING_BITS}"
The current set of warning checks enabled by the \f(CW\*(C`use warnings\*(C'\fR pragma.
It has the same scoping as the \f(CW$^H\fR and \f(CW\*(C`%^H\*(C'\fR variables.  The exact
values are considered internal to the warnings pragma and may change
between versions of Perl.
.Sp
This variable was added in Perl v5.6.0.
.ie n .IP "$OS_ERROR" 8
.el .IP "\f(CW$OS_ERROR\fR" 8
.IX Item "$OS_ERROR"
.PD 0
.ie n .IP "$ERRNO" 8
.el .IP "\f(CW$ERRNO\fR" 8
.IX Item "$ERRNO"
.IP "$!" 8
.IX Xref "$! $ERRNO $OS_ERROR"
.PD
When referenced, \f(CW$!\fR retrieves the current value
of the C \f(CW\*(C`errno\*(C'\fR integer variable.
If \f(CW$!\fR is assigned a numerical value, that value is stored in \f(CW\*(C`errno\*(C'\fR.
When referenced as a string, \f(CW$!\fR yields the system error string
corresponding to \f(CW\*(C`errno\*(C'\fR.
.Sp
Many system or library calls set \f(CW\*(C`errno\*(C'\fR if they fail,
to indicate the cause of failure.  They usually do \fBnot\fR
set \f(CW\*(C`errno\*(C'\fR to zero if they succeed.  This means \f(CW\*(C`errno\*(C'\fR,
hence \f(CW$!\fR, is meaningful only \fIimmediately\fR after a \fBfailure\fR:
.Sp
.Vb 11
\&    if (open my $fh, "<", $filename) {
\&                # Here $! is meaningless.
\&                ...
\&    }
\&    else {
\&                # ONLY here is $! meaningful.
\&                ...
\&                # Already here $! might be meaningless.
\&    }
\&    # Since here we might have either success or failure,
\&    # $! is meaningless.
.Ve
.Sp
Here, \fImeaningless\fR means that \f(CW$!\fR may be unrelated to the outcome
of the \f(CW\*(C`open()\*(C'\fR operator.  Assignment to \f(CW$!\fR is similarly ephemeral.
It can be used immediately before invoking the \f(CW\*(C`die()\*(C'\fR operator,
to set the exit value, or to inspect the system error string
corresponding to error \fIn\fR, or to restore \f(CW$!\fR to a meaningful state.
.Sp
Mnemonic: What just went bang?
.ie n .IP "%OS_ERROR" 8
.el .IP "\f(CW%OS_ERROR\fR" 8
.IX Item "%OS_ERROR"
.PD 0
.ie n .IP "%ERRNO" 8
.el .IP "\f(CW%ERRNO\fR" 8
.IX Item "%ERRNO"
.IP "%!" 8
.IX Xref "%! %OS_ERROR %ERRNO"
.PD
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).  The
specific true value is not guaranteed, but in the past has generally
been the numeric value of \f(CW$!\fR.  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
\&\*(L"$!\*(R".
.Sp
This variable was added in Perl 5.005.
.ie n .IP "$CHILD_ERROR" 8
.el .IP "\f(CW$CHILD_ERROR\fR" 8
.IX Item "$CHILD_ERROR"
.PD 0
.IP "$?" 8
.IX Xref "$? $CHILD_ERROR"
.PD
The status returned by the last pipe close, backtick (\f(CW\*(C`\`\`\*(C'\fR) command,
successful call to \f(CW\*(C`wait()\*(C'\fR or \f(CW\*(C`waitpid()\*(C'\fR, or from the \f(CW\*(C`system()\*(C'\fR
operator.  This is just the 16\-bit status word returned by the
traditional Unix \f(CW\*(C`wait()\*(C'\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.
.Sp
Additionally, if the \f(CW\*(C`h_errno\*(C'\fR variable is supported in C, its value
is returned via \f(CW$?\fR 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 \*(Aqstatus\*(Aq\*(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
Mnemonic: similar to \fBsh\fR and \fBksh\fR.
.ie n .IP "$EVAL_ERROR" 8
.el .IP "\f(CW$EVAL_ERROR\fR" 8
.IX Item "$EVAL_ERROR"
.PD 0
.IP "$@" 8
.IX Xref "$@ $EVAL_ERROR"
.PD
The Perl error from the last \f(CW\*(C`eval\*(C'\fR operator, i.e. the last exception that
was caught.  For \f(CW\*(C`eval BLOCK\*(C'\fR, this is either a runtime error message or the
string or reference \f(CW\*(C`die\*(C'\fR was called with.  The \f(CW\*(C`eval STRING\*(C'\fR form also
catches syntax errors and other compile time exceptions.
.Sp
If no error occurs, \f(CW\*(C`eval\*(C'\fR sets \f(CW$@\fR to the empty string.
.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 in \*(L"%SIG\*(R".
.Sp
Mnemonic: Where was the error \*(L"at\*(R"?
.SS "Variables related to the interpreter state"
.IX Subsection "Variables related to the interpreter state"
These variables provide information about the current interpreter state.
.ie n .IP "$COMPILING" 8
.el .IP "\f(CW$COMPILING\fR" 8
.IX Item "$COMPILING"
.PD 0
.IP "$^C" 8
.IX Xref "$^C $COMPILING"
.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 \f(CW\*(C`AUTOLOAD\*(C'\fR at compile
time rather than normal, deferred loading.  Setting
\&\f(CW\*(C`$^C = 1\*(C'\fR is similar to calling \f(CW\*(C`B::minus_c\*(C'\fR.
.Sp
This variable was added in Perl v5.6.0.
.ie n .IP "$DEBUGGING" 8
.el .IP "\f(CW$DEBUGGING\fR" 8
.IX Item "$DEBUGGING"
.PD 0
.IP "$^D" 8
.IX Xref "$^D $DEBUGGING"
.IX Item "$^D"
.PD
The current value of the debugging flags.  May be read or set.  Like its
command-line equivalent, you can use numeric
or symbolic values, e.g. \f(CW\*(C`$^D = 10\*(C'\fR or \f(CW\*(C`$^D = "st"\*(C'\fR.  See
"\fB\-D\fR\fInumber\fR" in perlrun.  The contents of this variable also affects the
debugger operation.  See \*(L"Debugger Internals\*(R" in perldebguts.
.Sp
Mnemonic: value of \fB\-D\fR switch.
.IP "${^ENCODING}" 8
.IX Xref "${^ENCODING}"
.IX Item "${^ENCODING}"
This variable is no longer supported.
.Sp
It used to hold the \fIobject reference\fR to the \f(CW\*(C`Encode\*(C'\fR object that was
used to convert the source code to Unicode.
.Sp
Its purpose was to allow your non-ASCII Perl
scripts not to have to be written in \s-1UTF\-8\s0; this was
useful before editors that worked on \s-1UTF\-8\s0 encoded text were common, but
that was long ago.  It caused problems, such as affecting the operation
of other modules that weren't expecting it, causing general mayhem.
.Sp
If you need something like this functionality, it is recommended that use
you a simple source filter, such as Filter::Encoding.
.Sp
If you are coming here because code of yours is being adversely affected
by someone's use of this variable, you can usually work around it by
doing this:
.Sp
.Vb 1
\& local ${^ENCODING};
.Ve
.Sp
near the beginning of the functions that are getting broken.  This
undefines the variable during the scope of execution of the including
function.
.Sp
This variable was added in Perl 5.8.2 and removed in 5.26.0.
Setting it to anything other than \f(CW\*(C`undef\*(C'\fR was made fatal in Perl 5.28.0.
.IP "${^GLOBAL_PHASE}" 8
.IX Xref "${^GLOBAL_PHASE}"
.IX Item "${^GLOBAL_PHASE}"
The current phase of the perl interpreter.
.Sp
Possible values are:
.RS 8
.IP "\s-1CONSTRUCT\s0" 8
.IX Item "CONSTRUCT"
The \f(CW\*(C`PerlInterpreter*\*(C'\fR is being constructed via \f(CW\*(C`perl_construct\*(C'\fR.  This
value is mostly there for completeness and for use via the
underlying C variable \f(CW\*(C`PL_phase\*(C'\fR.  It's not really possible for Perl
code to be executed unless construction of the interpreter is
finished.
.IP "\s-1START\s0" 8
.IX Item "START"
This is the global compile-time.  That includes, basically, every
\&\f(CW\*(C`BEGIN\*(C'\fR block executed directly or indirectly from during the
compile-time of the top-level program.
.Sp
This phase is not called \*(L"\s-1BEGIN\*(R"\s0 to avoid confusion with
\&\f(CW\*(C`BEGIN\*(C'\fR\-blocks, as those are executed during compile-time of any
compilation unit, not just the top-level program.  A new, localised
compile-time entered at run-time, for example by constructs as
\&\f(CW\*(C`eval "use SomeModule"\*(C'\fR are not global interpreter phases, and
therefore aren't reflected by \f(CW\*(C`${^GLOBAL_PHASE}\*(C'\fR.
.IP "\s-1CHECK\s0" 8
.IX Item "CHECK"
Execution of any \f(CW\*(C`CHECK\*(C'\fR blocks.
.IP "\s-1INIT\s0" 8
.IX Item "INIT"
Similar to \*(L"\s-1CHECK\*(R",\s0 but for \f(CW\*(C`INIT\*(C'\fR\-blocks, not \f(CW\*(C`CHECK\*(C'\fR blocks.
.IP "\s-1RUN\s0" 8
.IX Item "RUN"
The main run-time, i.e. the execution of \f(CW\*(C`PL_main_root\*(C'\fR.
.IP "\s-1END\s0" 8
.IX Item "END"
Execution of any \f(CW\*(C`END\*(C'\fR blocks.
.IP "\s-1DESTRUCT\s0" 8
.IX Item "DESTRUCT"
Global destruction.
.RE
.RS 8
.Sp
Also note that there's no value for UNITCHECK-blocks.  That's because
those are run for each compilation unit individually, and therefore is
not a global interpreter phase.
.Sp
Not every program has to go through each of the possible phases, but
transition from one phase to another can only happen in the order
described in the above list.
.Sp
An example of all of the phases Perl code can see:
.Sp
.Vb 1
\&    BEGIN { print "compile\-time: ${^GLOBAL_PHASE}\en" }
\&
\&    INIT  { print "init\-time: ${^GLOBAL_PHASE}\en" }
\&
\&    CHECK { print "check\-time: ${^GLOBAL_PHASE}\en" }
\&
\&    {
\&        package Print::Phase;
\&
\&        sub new {
\&            my ($class, $time) = @_;
\&            return bless \e$time, $class;
\&        }
\&
\&        sub DESTROY {
\&            my $self = shift;
\&            print "$$self: ${^GLOBAL_PHASE}\en";
\&        }
\&    }
\&
\&    print "run\-time: ${^GLOBAL_PHASE}\en";
\&
\&    my $runtime = Print::Phase\->new(
\&        "lexical variables are garbage collected before END"
\&    );
\&
\&    END   { print "end\-time: ${^GLOBAL_PHASE}\en" }
\&
\&    our $destruct = Print::Phase\->new(
\&        "package variables are garbage collected after END"
\&    );
.Ve
.Sp
This will print out
.Sp
.Vb 7
\&    compile\-time: START
\&    check\-time: CHECK
\&    init\-time: INIT
\&    run\-time: RUN
\&    lexical variables are garbage collected before END: RUN
\&    end\-time: END
\&    package variables are garbage collected after END: DESTRUCT
.Ve
.Sp
This variable was added in Perl 5.14.0.
.RE
.IP "$^H" 8
.IX Xref "$^H"
.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 \f(CW$^H\fR 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 \f(CW$^H\fR.
.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 }
\&
\&    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 \f(CW\*(C`foo()\*(C'\fR is still
being compiled.  The new value of \f(CW$^H\fR
will therefore be visible only while
the body of \f(CW\*(C`foo()\*(C'\fR is being compiled.
.Sp
Substitution of \f(CW\*(C`BEGIN { add_100() }\*(C'\fR block with:
.Sp
.Vb 1
\&    BEGIN { require strict; strict\->import(\*(Aqvars\*(Aq) }
.Ve
.Sp
demonstrates how \f(CW\*(C`use strict \*(Aqvars\*(Aq\*(C'\fR is implemented.  Here's a conditional
version of the same lexical pragma:
.Sp
.Vb 3
\&    BEGIN {
\&        require strict; strict\->import(\*(Aqvars\*(Aq) if $condition
\&    }
.Ve
.Sp
This variable was added in Perl 5.003.
.IP "%^H" 8
.IX Xref "%^H"
.IX Item "%^H"
The \f(CW\*(C`%^H\*(C'\fR hash provides the same scoping semantic as \f(CW$^H\fR.  This makes
it useful for implementation of lexically scoped pragmas.  See
perlpragma.   All the entries are stringified when accessed at
runtime, so only simple values can be accommodated.  This means no
pointers to objects, for example.
.Sp
When putting items into \f(CW\*(C`%^H\*(C'\fR, in order to avoid conflicting with other
users of the hash there is a convention regarding which keys to use.
A module should use only keys that begin with the module's name (the
name of its main package) and a \*(L"/\*(R" character.  For example, a module
\&\f(CW\*(C`Foo::Bar\*(C'\fR should use keys such as \f(CW\*(C`Foo::Bar/baz\*(C'\fR.
.Sp
This variable was added in Perl v5.6.0.
.IP "${^OPEN}" 8
.IX Xref "${^OPEN}"
.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.
.Sp
This variable was added in Perl v5.8.0.
.ie n .IP "$PERLDB" 8
.el .IP "\f(CW$PERLDB\fR" 8
.IX Item "$PERLDB"
.PD 0
.IP "$^P" 8
.IX Xref "$^P $PERLDB"
.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.  Causes \f(CW\*(C`DB::DB()\*(C'\fR subroutine to be called for
each statement executed.  Also causes saving source code lines (like
0x400).
.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.
.IP "0x400" 6
.IX Item "0x400"
Save source code lines into \f(CW\*(C`@{"_<$filename"}\*(C'\fR.
.IP "0x800" 6
.IX Item "0x800"
When saving source, include evals that generate no subroutines.
.IP "0x1000" 6
.IX Item "0x1000"
When saving source, include source that did not compile.
.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.
See also perldebguts.
.RE
.IP "${^TAINT}" 8
.IX Xref "${^TAINT}"
.IX Item "${^TAINT}"
Reflects if taint mode is on or off.  1 for on (the program was run with
\&\fB\-T\fR), 0 for off, \-1 when only taint warnings are enabled (i.e. with
\&\fB\-t\fR or \fB\-TU\fR).
.Sp
This variable is read-only.
.Sp
This variable was added in Perl v5.8.0.
.IP "${^SAFE_LOCALES}" 8
.IX Xref "${^SAFE_LOCALES}"
.IX Item "${^SAFE_LOCALES}"
Reflects if safe locale operations are available to this perl (when the
value is 1) or not (the value is 0).  This variable is always 1 if the
perl has been compiled without threads.  It is also 1 if this perl is
using thread-safe locale operations.  Note that an individual thread may
choose to use the global locale (generally unsafe) by calling
\&\*(L"switch_to_global_locale\*(R" in perlapi.  This variable currently is still
set to 1 in such threads.
.Sp
This variable is read-only.
.Sp
This variable was added in Perl v5.28.0.
.IP "${^UNICODE}" 8
.IX Xref "${^UNICODE}"
.IX Item "${^UNICODE}"
Reflects certain Unicode settings of Perl.  See perlrun
documentation for the \f(CW\*(C`\-C\*(C'\fR switch for more information about
the possible values.
.Sp
This variable is set during Perl startup and is thereafter read-only.
.Sp
This variable was added in Perl v5.8.2.
.IP "${^UTF8CACHE}" 8
.IX Xref "${^UTF8CACHE}"
.IX Item "${^UTF8CACHE}"
This variable controls the state of the internal \s-1UTF\-8\s0 offset caching code.
1 for on (the default), 0 for off, \-1 to debug the caching code by checking
all its results against linear scans, and panicking on any discrepancy.
.Sp
This variable was added in Perl v5.8.9.  It is subject to change or
removal without notice, but is currently used to avoid recalculating the
boundaries of multi-byte UTF\-8\-encoded characters.
.IP "${^UTF8LOCALE}" 8
.IX Xref "${^UTF8LOCALE}"
.IX Item "${^UTF8LOCALE}"
This variable indicates whether a \s-1UTF\-8\s0 locale was detected by perl at
startup.  This information is used by perl when it's in
adjust\-utf8ness\-to\-locale mode (as when run with the \f(CW\*(C`\-CL\*(C'\fR command-line
switch); see perlrun for more info on this.
.Sp
This variable was added in Perl v5.8.8.
.SS "Deprecated and removed variables"
.IX Subsection "Deprecated and removed variables"
Deprecating a variable announces the intent of the perl maintainers to
eventually remove the variable from the language.  It may still be
available despite its status.  Using a deprecated variable triggers
a warning.
.PP
Once a variable is removed, its use triggers an error telling you
the variable is unsupported.
.PP
See perldiag for details about error messages.
.IP "$#" 8
.IX Xref "$#"
\&\f(CW$#\fR was a variable that could be used to format printed numbers.
After a deprecation cycle, its magic was removed in Perl v5.10.0 and
using it now triggers a warning: \f(CW\*(C`$# is no longer supported\*(C'\fR.
.Sp
This is not the sigil you use in front of an array name to get the
last index, like \f(CW$#array\fR.  That's still how you get the last index
of an array in Perl.  The two have nothing to do with each other.
.Sp
Deprecated in Perl 5.
.Sp
Removed in Perl v5.10.0.
.IP "$*" 8
.IX Xref "$*"
\&\f(CW$*\fR was a variable that you could use to enable multiline matching.
After a deprecation cycle, its magic was removed in Perl v5.10.0.
Using it now triggers a warning: \f(CW\*(C`$* is no longer supported\*(C'\fR.
You should use the \f(CW\*(C`/s\*(C'\fR and \f(CW\*(C`/m\*(C'\fR regexp modifiers instead.
.Sp
Deprecated in Perl 5.
.Sp
Removed in Perl v5.10.0.
.IP "$[" 8
.IX Xref "$["
This variable stores the index of the first element in an array, and
of the first character in a substring.  The 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 \fBindex()\fR and \fBsubstr()\fR functions.
.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.
(That's why you can only assign compile-time constants to it.)
Its use is highly discouraged.
.Sp
Prior to Perl v5.10.0, assignment to \f(CW$[\fR could be seen from outer lexical
scopes in the same file, unlike other compile-time directives (such as
strict).  Using \fBlocal()\fR on it would bind its value strictly to a lexical
block.  Now it is always lexically scoped.
.Sp
As of Perl v5.16.0, it is implemented by the arybase module.
.Sp
As of Perl v5.30.0, or under \f(CW\*(C`use v5.16\*(C'\fR, or \f(CW\*(C`no feature "array_base"\*(C'\fR,
\&\f(CW$[\fR no longer has any effect, and always contains 0.
Assigning 0 to it is permitted, but any other value will produce an error.
.Sp
Mnemonic: [ begins subscripts.
.Sp
Deprecated in Perl v5.12.0.

Man Man