Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Special Vars Quick Reference

$_The default or implicit variable.
@_Subroutine parameters.
$a
$b
sort comparison routine variables.
@ARGVThe command-line args.
Regular Expressions
$<digit>Regexp parenthetical capture holders.
$&Last successful match (degrades performance).
${^MATCH}Similar to $& without performance penalty. Requires /p modifier.
$`Prematch for last successful match string (degrades performance).
${^PREMATCH}Similar to $` without performance penalty. Requires /p modifier.
$'Postmatch for last successful match string (degrades performance).
${^POSTMATCH}Similar to $' without performance penalty. Requires /p modifier.
$+Last paren match.
$^NLast 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.
$^RLast regexp (?{code}) result.
${^RE_DEBUG_FLAGS}Current value of regexp debugging flags. See use re 'debug';
${^RE_TRIE_MAXBUF}Control memory allocations for RE optimizations for large alternations.
Encoding
${^ENCODING}The object reference to the Encode object, used to convert the source code to Unicode.
${^OPEN}Internal use: \0 separated Input / Output layer information.
${^UNICODE}Read-only Unicode settings.
${^UTF8CACHE}State of the internal UTF-8 offset caching code.
${^UTF8LOCALE}Indicates whether UTF8 locale was detected at startup.
IO and Separators
$.Current line number (or record number) of most recent filehandle.
$/Input record separator.
$|Output autoflush. 1=autoflush, 0=default. Applies to currently selected handle.
$,Output field separator (lists)
$\Output record separator.
$"Output list separator. (interpolated lists)
$;Subscript separator. (Use a real multidimensional array instead.)
Formats
$%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
$^LForm feed (default "\f").
$^AFormat Accumulator
Status Reporting
$?Child error. Status code of most recent system call or pipe.
$!Operating System Error. (What just went 'bang'?)
%!Error number hash
$^EExtended Operating System Error (Extra error explanation).
$@Eval error.
${^CHILD_ERROR_NATIVE}Native status returned by the last pipe close, backtick (`` ) command, successful call to wait() or waitpid(), or from the system() operator.
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.
$0Program name.
$^OOperating System name.
Perl Status Info
$]Old: Version and patch number of perl interpreter. Deprecated.
$^CCurrent value of flag associated with -c switch.
$^DCurrent value of debugging flags
$^FMaximum system file descriptor.
$^IValue of the -i (inplace edit) switch.
$^MEmergency Memory pool.
$^PInternal variable for debugging support.
$^RLast regexp (?{code}) result.
$^SExceptions being caught. (eval)
$^TBase time of program start.
$^VPerl version.
$^WStatus of -w switch
${^WARNING_BITS}Current set of warning checks enabled by use warnings;
$^XPerl executable name.
${^GLOBAL_PHASE}Current phase of the Perl interpreter.
$^HInternal use only: Hook into Lexical Scoping.
%^HInternaluse only: Useful to implement scoped pragmas.
${^TAINT}Taint mode read-only flag.
${^WIN32_SLOPPY_STAT}If true on Windows stat() won't try to open the file.
Command Line Args
ARGVFilehandle iterates over files from command line (see also <>).
$ARGVName of current file when reading <>
@ARGVList of command line args.
ARGVOUTOutput filehandle for -i switch
Miscellaneous
@FAutosplit (-a mode) recipient.
@INCList of library paths.
%INCKeys are filenames, values are paths to modules included via use, require, or do.
%ENVHash containing current environment variables
%SIGSignal handlers.
$[Array and substr first element (Deprecated!).

See perlvar for detailed descriptions of each of these (and a few more) special variables.

When modifiying special variables, it is often a good practice to localize the effects of the change. ie,

my @array = ( 1, 2, 3, 4, 5 ); print "@array\n"; { local $" = "\t"; print "@array\n"; } print "@array\n";

And the output.....

1 2 3 4 5 1 2 3 4 5 1 2 3 4 5

The purpose of this node is to provide a super-concise categorized quick crossreference to Perl's special variables. perlvar provides a list in asciibetical order but doesn't really put the variables into easy to find categories.


In reply to Perl Special Variables Quick Reference by davido

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (18)
    As of 2014-08-01 15:24 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Who would be the most fun to work for?















      Results (27 votes), past polls