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 which are all capitalized
-
Simple arrays with @ as the initial character
-
Associative arrays or dictionaries with % as initial character
|
Arrays , represented by @fred are defined by comma-separated list of scalars
-
@fred = (1, "second entry", $hw); # is an array with three entries
|
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
|