Perl Hash Tables
ASSIGNING HASH VALUES
hash tables consist of key/value pairs
every key is followed by a value
values can be assigned to hash tables as
%states = ( "California","Sacramento", "Wisconsin","Madison", "New York", "Albany");
OR
of key and value; it uses the => operator to identify the
key to the left, and the value to the right; if the => operator
encounters bare words in key positions, they will be automatically
quoted (note "New York", however, which consists of two words
and MUST be quoted
%states = (California => "Sacramento", Wisconsin => "Madison" , "New York" => "Albany");
In above example California is key and Sacromento is value.
Similarily Wisconsin is key and Madison is value.
Printing:
print "Capital of California is " . $states{"California"} . "\n\n";