Hashes in Perl aren't really that hard to understand; they're not that much harder than understanding how a phone book works. This article introduces you to hashes, what they do, and how to use them. It is excerpted from chapter five of the book Beginning Perl, written by James Lee (Apress; ISBN: 159059391X).
Hash entries are very much like ordinary scalar variables, except that you need not declare an individual hash key before assigning to it or using it. We can add a new person to our hash just by assigning to their hash entry:
$where{Eva} = "Uxbridge"; print "Eva lives in $where{Eva}\n";
A new entry springs into existence, without any problems. We can also change the entries in a hash just by reassigning to them. Let’s move people around a little: