in reply to hash : how to add values and keys dynamically
It might well be much simpler than you think. Perl has a very cool feature that is known by the fancy-pants term, “auto-vivication,” which basically means that you can create complicated data structures “all at once,” automagically creating the intervening hashes, hash-slots and so on without having to do so pedantically. You can also do things in one step, e.g. $$myhash{'foo'}++; will automagically create a 'foo' slot, with an initial value of zero (subsequently incremented to 1 as you requested), and “It Just Works.™” Perl is very much a pragmatic language, built by real-world practitioners (not academics) to earn their daily bread.