1 |
One can think of a hash as a simple relational database with two columns and multiple rows labelled by keys
|
2 |
For example, hashes can be used to store data defined by MIME or HTTP as these protocols are specified in terms of a set of header statements
-
Content-type: text/plain # corresponds to
-
$mime{Content-type} = "text/plain"; # and so on
|
3 |
Similarly this data type can be used to store values read as arguments of a UNIX command as these are either of form
-
-keyname value # or
-
-keyname # just to indicate option set (value = yes or no)
|