[Perl] Perl Specail Vars

郤仰岳
2023-12-01
$_ The default or implicit variable.
@_ Subroutine parameters.
$a
$b
sort comparison routine variables.
Regular Expressions
$<digit> Regexp parenthetical capture holders.
$& Last successful match (degrades performance).
$` Prematch for last successful match string (degrades performance).
$' Postmatch for last successful match string (degrades performance).
$+ Last paren match.
$^N Last closed paren match.
@+ Offsets of ends of successful submatches in scope.
@- Offsets of starts of successful submatches in scope.
$* Boolean for multi-line matching. Deprecated. Use /s and /m.
$^R Last regexp (?{code}) result.
IO and Separators
$. Current line number (or record number) of most recent filehandle.
$/ Input record separator.
$| Output autoflush. 1=autoflush, 0=default
$, Output field separator (lists)
$/ Output record separator.
$" Output list separator. (interpolated lists)
$; Subscript separator. (Use a real multidimensional array instead.)
Formats
$# Output format for printed numbers (deprecated).
$% Page number for currently selected output channel.
$= Current page length.
$- Number of lines left on page.
$~ Format name.
$^ Name of top-of-page format.
$: Format line break characters
$^L Form feed (default "/f").
$^A Format Accumulator
Status Reporting
$? Child error. Status code of most recent system call or pipe.
$! Operating System Error. (What just went 'bang'?)
%! Error number hash
$^E Extended Operating System Error (Extra error explanation).
$@ Eval error.
ID's and Process Information
$$ Process ID
$< Real user id of process.
$> Effective user id of process.
$( Real group id of process.
$) Effective group id of process.
$0 Program name.
$^O Operating System name.
Perl Status Info
$] Version and patch number of perl interpreter.
$^C Current value of flag associated with -c switch.
$^D Current value of debugging flags
$^F Maximum file descriptor.
$^I Value of the -i (inplace edit) switch.
$^M Emergency Memory pool.
$^P Internal variable for debugging support.
$^R Last regexp (?{code}) result.
$^S Exceptions being caught. (eval)
$^T Base time of program start.
$^V Perl version.
$^W Status of -w switch
$^X Perl executable name.
Command Line Args
ARGV Filehandle iterates over files from command line (see also <> ).
$ARGV Name of current file when reading <>
@ARGV List of command line args.
ARGVOUT Output filehandle for -i switch
Miscellaneous
@F Autosplit (-a mode) recipient.
@INC List of library paths.
%INC Keys are filenames, values are paths to modules included via use, require, or do .
%ENV Hash containing current environment variables
%SIG Signal handlers.
$[ Array and substr first element (Deprecated!).
 类似资料: