Full documentation of predefined variables:perlvar
$_ - The default input and pattern-searching space
$a,$b - Special package variables when using sort(), see"sort" in perlfunc
$<digits> - Contains the subpattern from the corresponding set of capturing parentheses from the last pattern match, not counting patterns matched in nested blocks that have been exited already
$& - The string matched by the last successful pattern match (not counting any matches hidden within a BLOCK or eval() enclosed by the current BLOCK)
$` - The string preceding whatever was matched by the last successful pattern match (not counting any matches hidden within a BLOCK or eval enclosed by the current BLOCK)
$' - The string following whatever was matched by the last successful pattern match (not counting any matches hidden within a BLOCK or eval() enclosed by the current BLOCK)
$+ - The text matched by the last bracket of the last successful search pattern
$^N - The text matched by the used group most-recently closed (i.e. the group with the rightmost closing parenthesis) of the last successful search pattern
@+ - This array holds the offsets of the ends of the last successful submatches in the currently active dynamic scope
$* - Set to a non-zero integer value to do multi-line matching within a string, 0 (or undefined) to tell Perl that it can assume that strings contain a single line, for the purpose of optimizing pattern matches
$. - Current line number for the last filehandle accessed
$/ - The input record separator, newline by default
$| - If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel
$, - The output field separator for the print operator
$\ - The output record separator for the print operator
$" - This is like$,
except that it applies to array and slice values interpolated into a double-quoted string (or similar interpreted string)
$; - The subscript separator for multidimensional array emulation
$# - The output format for printed numbers
$% - The current page number of the currently selected output channel
$= - The current page length (printable lines) of the currently selected output channel
$- - The number of lines left on the page of the currently selected output channel
@- - $-[0] is the offset of the start of the last successful match
$~ - The name of the current report format for the currently selected output channel
$^ - The name of the current top-of-page format for the currently selected output channel
$: - The current set of characters after which a string may be broken to fill continuation fields (starting with ^) in a format
$^L - What formats output as a form feed
$^A - The current value of the write() accumulator for format() lines
$? - The status returned by the last pipe close, backtick (``
) command, successful call to wait() or waitpid(), or from the system() operator
${^ENCODING} - Theobject reference to the Encode object that is used to convert the source code to Unicode
$! - If used numerically, yields the current value of the Cerrno
variable, or in other words, if a system or library call fails, it sets this variable
%! - Each element of%!
has a true value only if$!
is set to that value
$^E - Error information specific to the current operating system
$@ - The Perl syntax error message from the last eval() operator
$$ - The process number of the Perl running this script
$< - The real uid of this process
$> - The effective uid of this process
$( - The real gid of this process
$) - The effective gid of this process
$0 - Contains the name of the program being executed
$[ - The index of the first element in an array, and of the first character in a substring
$] - The version + patchlevel / 1000 of the Perl interpreter
$^C - The current value of the flag associated with the-c switch
$^D - The current value of the debugging flags
$^F - The maximum system file descriptor, ordinarily 2. System file descriptors are passed to exec()ed processes, while higher file descriptors are not
$^H - This variable contains compile-time hints for the Perl interpreter
%^H - The %^H hash provides the same scoping semantic as $^H. This makes it useful for implementation of lexically scoped pragmas
$^I - The current value of the inplace-edit extension
$^M - Perl can use the contents of$^M
as an emergency memory pool after die()ing
$^O - The name of the operating system under which this copy of Perl was built, as determined during the configuration process
${^OPEN} - An internal variable used by PerlIO
$^P - The internal variable for debugging support
$^R - The result of evaluation of the last successful(?{ code })
regular expression assertion (seeperlre)
$^S - Current state of the interpreter
$^T - The time at which the program began running, in seconds since the epoch (beginning of 1970)
${^TAINT} - Reflects if taint mode is on or off
${^UNICODE} - Reflects certain Unicode settings of Perl
${^UTF8LOCALE} - This variable indicates whether an UTF-8 locale was detected by perl at startup
$^V - The revision, version, and subversion of the Perl interpreter, represented as a string composed of characters with those ordinals
$^W - The current value of the warning switch, initially true if-w was used, false otherwise, but directly modifiable
${^WARNING_BITS} - The current set of warning checks enabled by theuse warnings
pragma
$^X - The name used to execute the current copy of Perl, from C'sargv[0]
or (where supported)/proc/self/exe
ARGV - The special filehandle that iterates over command-line filenames in@ARGV
$ARGV - contains the name of the current file when reading from <>
@ARGV - The array @ARGV contains the command-line arguments intended for the script
ARGVOUT - The special filehandle that points to the currently open output file when doing edit-in-place processing with-i
@F - The array @F contains the fields of each line read in when autosplit mode is turned on
@INC - The array @INC contains the list of places that thedo EXPR
,require
, oruse
constructs look for their library files
@_ - Within a subroutine the array @_ contains the parameters passed to that subroutine
%INC - The hash %INC contains entries for each filename included via thedo
,require
, oruse
operators
$ENV{expr} - The hash %ENV contains your current environment
$SIG{expr} - The hash %SIG contains signal handlers for signals
Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via theGitHub issue tracker oremail regarding any issues with the site itself, search, or rendering of documentation.
The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via thePerl issue tracker, themailing list, orIRC to report any issues with the contents or format of the documentation.