O'Reilly logo

Perl Pocket Reference, 4th Edition by Johan Vromans

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 36. Special Variables

The alternative names for special variables are provided by the standard module English.

The following variables are global and should be localized in subroutines:

$_

Alternative: $ARG.

The default input, output, and pattern-searching space.

$.

Alternatives: $INPUT_LINE_NUMBER, $NR.

The current input line number of the last filehandle that was read. Reset only when the filehandle is closed explicitly.

$/

Alternatives: $INPUT_RECORD_SEPARATOR, $RS.

The string that separates input records. Default value is a newline.

$,

Alternatives: $OUTPUT_FIELD_SEPARATOR, $OFS.

The output field separator for the print functions. Default value is an empty string.

$"

Alternative: $LIST_SEPARATOR.

The separator that joins elements of arrays interpolated in strings. Default value is a single space.

$\

Alternatives: $OUTPUT_RECORD_SEPARATOR, $ORS.

The output record separator for the print functions. Default value is an empty string.

$#

The output format for printed numbers. Deprecated. Use printf instead.

$*

Set to 1 to do multiline matching within strings. Deprecated; see the m and s modifiers.

$?

Alternative: $CHILD_ERROR.

The status returned by the last ` . . . ` command, pipe close, wait, waitpid, or system function.

$]

The Perl version number, e.g., 5.006. See also $^V.

$[

The index of the first element in an array or list, and of the first character in a substring. Default is zero. Deprecated. Do not use.

$;

Alternatives: $SUBSCRIPT_SEPARATOR, $SUBSEP.

The subscript separator for multidimensional ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required