Chapter 28. Special Names

This chapter is about variables that have special meanings to Perl. Most of the punctuational names have reasonable mnemonics, or analogs in one of the shells (or both). But if you want to use long variable names as synonyms, just say:

use English;

at the top of your program. This aliases all the short names to long names in the current package. Some of these variables even have medium names, generally borrowed from awk. Most people eventually settle on using the short names, at least for the more commonly used variables. Throughout this book, we consistently refer to the short names, but also often mention the long names (in parentheses) so that you can look them up easily in this chapter.

The semantics of these variables can be quite magical. (To create your own magic, see Chapter 14.) A few of these variables are read-only. If you try to assign values to them, an exception will be raised.

In what follows, we'll first provide a concise listing of the variables and functions for which Perl assigns a special meaning, grouped by type, so you can look up variables that you're not sure of the proper name. Then we'll explain all of the variables alphabetically under their proper name (or their least improper name).

Special Names Grouped by Type

We used the word "type" loosely--the sections here actually group variables more by their scope, that is, where they're visible from.

Regular Expression Special Variables

The following special variables related to pattern matching ...

Get Programming Perl, 3rd Edition 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.