Normal arrays are ordered lists of scalars indexed by number, starting with 0. Values are usually referred to by name, or through a named reference. The first character 0xff value in binary option the name tells you to what sort of data structure it refers.
The rest of the name tells you the particular value to which it refers. Usually this name is a single identifier, that is, a string beginning with a letter or underscore, and containing letters, underscores, and digits. For a more in-depth discussion on identifiers, see Identifier parsing. It’s possible to substitute for a simple identifier, an expression that produces a reference to the value at runtime. Perl also has its own built-in variables whose names don’t follow these rules.
They have strange names so they don’t accidentally collide with one of your normal variables. In addition, several special variables that provide windows into the inner working of Perl have names containing punctuation characters. English word “the” in that it indicates a single value is expected. English, in that it indicates multiple values are expected. Every variable type has its own namespace, as do several non-variable identifiers. This means that you can, without fear of conflict, use the same name for a scalar variable, an array, or a hash–or, for that matter, for a filehandle, a directory handle, a subroutine name, a format name, or a label.
This may seem a bit weird, but that’s okay, because it is weird. They are reserved with respect to labels and filehandles, however, which don’t have an initial special character. You can’t have a filehandle named “log”, for instance. It is possible to replace such an alphanumeric name with an expression that returns a reference to the appropriate type.
For a description of this, see perlref. Names that start with a digit may contain only more digits. Names that do not start with a letter, underscore, digit or a caret are limited to one character, e. Most of these one character names have a predefined significance to Perl. And all such names are reserved for Perl’s possible use.
18, the actual rules of what a valid identifier was were a bit fuzzy. However, in general, anything defined here should work on previous versions of Perl, while the opposite — edge cases that work in previous versions, but aren’t defined here — probably won’t work on newer versions. That is, a “start” character followed by any number of “continue” characters. Perl additionally accepts identfier names beginning with an underscore.
That is, any word character in the ASCII range, as long as the first character is not a digit. Normal identifiers can start or end with a double colon, and can contain several parts delimited by double colons. Additionally, if the identifier is preceded by a sigil — that is, if the identifier is part of a variable name — it may optionally be enclosed in braces. For the most part, all of the identifiers in this category have a special meaning given by Perl. Because they have special parsing rules, these generally can’t be fully-qualified. Similar to the above, a sigil, followed by bareword text in braces, where the first character is a caret. The use of the other characters is unwise, as these are all reserved to have special meaning to Perl, and none of them currently do have special meaning, though this could change without notice.