June 2005
Beginner
480 pages
10h 31m
English
As you have seen, to retrieve a single value from a hash, simply use a $, the name of the hash, and (in curly braces) the key whose value you want to retrieve. Now consider this example:
%Movies = ( 'The Shining' => 'Kubrick', 'Ten Commandments' => 'DeMille', Goonies =>'Spielberg'); print $Movies{'The Shining'};
These lines print the value associated with the key The Shining in the hash %Movies. This example would print Kubrick.
Sometimes examining all the elements of a hash is useful. If all the keys of the hash are known, you can access them individually by key as shown previously. Most of the time, though, accessing ...
Read now
Unlock full access