The following variables are global and should be localized in subroutines:
- $_
-
The default input and pattern-searching space.
- $.
-
The current input line number of the last filehandle that was read.
- $/
-
The input record separator, newline by default. May be multicharacter.
- $,
-
The output field separator for the print operator.
- $"
-
The separator that joins elements of arrays interpolated in strings.
- $\
-
The output record separator for the print operator.
- $#
-
The output format for printed numbers. Deprecated.
- $*
-
Set to 1 to do multiline matching within strings.
Deprecated, see the m and s modifiers in
Search and Replace Functions.
- $?
-
The status returned by the last `...` command, pipe
close, or system operator.
- $]
-
The Perl version number, e.g., 5.001.
- $[
-
The index of the first element in an array, and of the first character
in a substring. Default is 0. Deprecated.
- $;
-
The subscript separator for multidimensional array emulation. Default
is "\034".
- $!
-
If used in a numeric context, yields the current value of errno. If
used in a string context, yields the corresponding error string.
- $@
-
The Perl error message from the last eval or do expr command.
- $:
-
The set of characters after which a string may be broken to fill
continuation fields (starting with ^) in a format.
- $0
-
The name of the file containing the Perl script being executed. May
have a value assigned to it.
- $$
-
The process ID of the currently executing Perl program. Altered (in the
child process) by fork.
- $<
-
The real user ID of this process.
- $>
-
The effective user ID of this process.
- $(
-
The real group ID of this process.
- $)
-
The effective group ID of this process.
- $^A
-
The accumulator for formline and write operations.
- $^D
-
The debug flags as passed to Perl using -D.
- $^F
-
The highest system file descriptor, ordinarily 2.
- $^I
-
In-place edit extension as passed to Perl using -i.
- $^L
-
Formfeed character used in formats.
- $^P
-
Internal debugging flag.
- $^T
-
The time (as delivered by time) when the program started. This
value is used by the file test operators -M, -A, and -C.
- $^W
-
The value of the -w option as passed to Perl.
- $^X
-
The name by which the currently executing program was invoked.