Show Menu

Special Vars Quick Reference Cheat Sheet by

Special Vars Quick Reference


The default or implicit variable
Subroutine parameters
$a $b
Sort comparison routine variables
The comman­d-line args

ID's and Process Inform­ation

Process ID
Real user id of process
Effective user id of process
Real group id of process
Effective group id of process
Program name
Operating System name


The object reference to the Encode object, used to convert the source code to Unicode
Internal use: \0 separated Input / Output layer inform­ation
Read-only Unicode settings
State of the internal UTF-8 offset caching code
Indicates whether UTF8 locale was detected at startup


Autosplit (-a mode) recipient
List of library paths
Keys are filenames, values are paths to modules included via
, or
Hash containing current enviro­nment variables
Signal handlers
Array and substr first element (Depre­cated!)

Status Reporting

Child error. Status code of most recent system call or pipe
Operating System Error. (What just went 'bang'?)
Extended Operating System Error (Extra error explan­ation)
Eval error
Native status returned by the last pipe close, backtick (`` ) command, successful call to wait() or waitpid(), or from the system() operator

IO and Separators

Current line number (or record number) of most recent filehandle
Input record separator
Output autoflush. 1=auto­flush, 0=default. Applies to currently selected handle
Output field separator (lists)
Output record separator
Output list separator. (inter­polated lists)
Subscript separator. (Use a real multid­ime­nsional array instead)

Regular Expres­sions

Regexp parent­hetical capture holders
Last successful match (degrades perfor­mance)
Similar to $& without perfor­mance penalty. Requires /p modifier
Prematch for last successful match string (degrades perfor­mance)
Similar to $` without perfor­mance penalty. Requires /p modifier
Postmatch for last successful match string (degrades perfor­mance)
Similar to $' without perfor­mance penalty. Requires /p modifier
Last paren match
Last closed paren match (last submatch)
Offsets of ends of successful submatches in scope
Offsets of starts of successful submatches in scope
Like @+, but for named submatches
Like @-, but for named submatches
Last regexp (?{code}) result
Current value of regexp debugging flags. See use re 'debug'
Control memory alloca­tions for RE optimi­zations for large altern­ations

Perl Status Info

Old: Version and patch number of perl interp­reter. Deprecated
Current value of flag associated with -c switch
Current value of debugging flags
Maximum system file descriptor
Value of the -i (inplace edit) switch
Emergency Memory pool
Internal variable for debugging support
Last regexp (?{code}) result
Exceptions being caught. (eval)
Base time of program start
Perl version
Status of -w switch
Current set of warning checks enabled by
use warnings;
Perl executable name
Current phase of the Perl interp­reter
Internal use only: Hook into Lexical Scoping
Intern­aluse only: Useful to implement scoped pragmas
Taint mode read-only flag
If true on Windows
won't try to open the file

Command Line Args

Filehandle iterates over files from command line (see also
Name of current file when reading <>
List of command line args
Output filehandle for -i switch


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Web Programming Cheat Sheet
          Perl Reference Card Cheat Sheet
          perlcheat Cheat Sheet

          More Cheat Sheets by respi

          Bash comparison options Cheat Sheet