Take a look at at 591877.
in reply to Re^3: Howto count elements within an interval
in thread Howto count elements within an interval
For some quick how-do-I-do-X, try http://www.cs.mcgill.ca/~abatko/computers/programming/perl/howto/hash/
A really easy introduction to hashes: http://www.devdaily.com/perl/perl-array-hash-tutorial-examples
This looks interesting: http://www.perl.org/books/beginning-perl/
...and, of course, the "Learning Perl" book http://oreilly.com/catalog/9780596520113 by merlyn