Hashes are an advanced form of array. One of the limitations of an array is that the information contained within it can be difficult to get to. For example, imagine that you have a list of people and their ages.
The hash solves this problem very neatly by allowing us to access that @ages array not by an index, but by a scalar key. For example to use age of different people we can use thier names as key to define a hash.
%ages = ('Martin' => 28,
'Sharon' => 35,
'Rikke' => 29,);
print "Rikke is $ages{Rikke} years old\n";
This will produce following result
Rikke is 29 years old
Comments