1 |
A hash (sometimes called an associative array) is a "software implemented" associative memory where values are fetched by names or attributes called keys
|
2 |
A hash is a set of pairs (key, value)
|
3 |
The entire array is referred to as %dict (for example):
-
$dict{key} = value; # NOTE curly braces {} to denote hash
|
4 |
The values can be used in ordinary arithmetic such as
-
$math{pi} = 3.14; $math{pi} += .0016; # sets $math{pi} = 3.1416;
-
either pi or 'pi' is allowed for specifying key
|
5 |
If key pimisspelt is undefined then $math{pimisspelt} returns undef and so one can easily see if a particular key has a value
|
6 |
Alternatively, the function exists($math{pimisspelt}) returns false unless key pimisspelt has a value
|