1 |
PERL has four types of variables distinguished by their initial character
-
Scalars with $ as initial character
-
File handles with nothing special as their initial characters and conventionally represented by names that are all capitalized
-
Arrays with @ as the initial character
-
Hashes (associative arrays, dictionaries) with % as initial character
|
2 |
Arrays (for example, @fred) may be initialized with a comma-separated list of scalars
-
@fred = (1, "second entry", $hw); # is an array with three entries
|
3 |
Array entries can include scalar variables and more generally expressions which are evaluated when the array entry is USED not when it is DEFINED -- this is a difference from C but is for instance similar to functions in a spreadsheet
-
@fred= (1, $hw . " more", $a+$b); # is an example of this
|