Special Perl Variables
Perl has several special built-in variables. These variables have a certain value, or take on a specific value without having to be told by the program. Table 29.2 lists and describes these special variables.
Variable | Purpose or Function |
---|---|
$_ | The default input and pattern-searching space. |
$. | The line number associated with the current line of the last filehandle read. |
$/ | The input record separator. |
$, | The output field separator for the print operation. |
$" | The separator that joins elements of arrays interpolated in strings. |
$\ | The output record separator for the print operator. |
$# | The output format for printed numbers. |
$* | Set to 1 to do multiline matching within strings. |
$? | The status returned by the last |
Get Practical UNIX now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.