Table A.4. Global
| Variable | What It Does |
|---|
| $_ | Default input and pattern-searching space. |
| $. | Current input line number of last filehandle that was read; must close the filehandle to reset line numbers for next filehandle. |
| $/ | Input record separator, newline by default. (Like RS in awk.) |
| $\ | Output record separator for the print function. Does not print a newline unless set: $\="\n" |
| $, | Output field separator for the print function. Normally delimiter is not printed between comma-separated strings unless set: S,=" ". |
| $" | Same as $ but applies to printing arrays when in double quotes. Default is space. |
| $# | Output format for numbers printed with the print function. (Like OMFT in awk.) |
| $$ | The process ID number of the Perl program running this script. |
| $? | Status returned by last pipe closed, command in backquotes, or system function. |
| $* | Default is 0. If set to 1, does a multiline match within a string; 0 for a match within a single line. |
| $0 | Name of this Perl script. |
| $[ | Index of first element of an array, and first character in a substring. Default is 0. |
| $] | The first part of the string is printed out when using perl -v for version information. |
| $; | The subscript separator for multidimensional array emulation. Default is \034. (Like SUBSEP in awk.) |
| $! | Yields the current value of errno (system error number) if numeric, and the corresponding system error string. |
| $@ | Error message from the last eval, do, or require function. |
| $< | The real uid of this process. |
| $> | The effective uid of this process. |
| $( | The real gid of this process. |
| $) | The effective gid of this process. |
| $: | The set of characters after which a string may be broken to fill continuation lines (starting with ^) in a format. Default is \n- to break on whitespace, newline, or colon. |
| $^A | The accumulator for formline and write operations. |
| $^C | TRUE if Perl is run in compile-only mode using command-line option -c. |
| $^D | Perl's debug flags when -D switch is used. |
| $^E | Operating-system-dependent error information. |
| $^F | Maximum file descriptor passed to subprocess, usually 2. |
| $^H | The current state of syntax checks. |
| $^I | Current value of inplace-edit extension when -i switch is used. Use undef to disable inplace editing. |
| $^L | Form feed character used in formats. |
| $^M | Emergency memory pool. |
| $^O | Name of the operating system. |
| $^P | Internal Perl debugging flag. |
| $^S | State of the Perl interpreter. |
| $^T | Time of day when script started execution. Used by -A, -C, and -M test operators and can be set to any number value returned by time to perform file tests relative to the current time. |
| $^V | The Perl version. |
| $^W | The current value of the warning switch. |
| $^X | The full pathname by which this Perl was invoked. |
| _ | An underscore. The special designator for file testing when stating files. |
| ARGV | The special filehandle array for looping over line arguments. |
| $ARGV | The variable containing the name of the current file when reading from <ARGV>. |
| @ARGV | The array containing command-line arguments. |
| DATA | Special filehandle referring to anything following _ _END_ _. |
| @F | The array into which input lines are autosplit when the -a switch is used. |
| @INC | Array containing pathnames where require and do functions look for files that are to be included in this script. |
| %INC | Associative array containing entries for files that have been included by calling do or require. The key is the filename and the value is its location. |
| %ENV | Associative array containing the current environment. |
| @EXPORT | Default symbols to be exported. |
| @EXPORT_OK | Symbols to be exported upon request by the user. |
| %EXPORT_TAGS | Used by Exporter.pm to collectively name sets of symbols. |
| %SIG | Associative array used to set signal handlers. |
| STDERR | Special filehandle for standard error. |
| STDIN | Special filehandle for standard input. |
| STDOUT | Special filehandle for standard output. |