in reply to how to find a key from a hash
(keys %myHas)[0] is a very short way to say "give me the first key of this hash". It may not be fast if %myHas is very large, but it will be fine for just a few elements. You can replace 0 with another number to get a different hash key, or with a random number to choose one randomly. The keys are in no particular order, but will consistently be returned in the same order, so if you use (keys %myHas)[0] you don't know exactly which key that will return, but once it has returned a key it will keep returning that one as long as the hash isn't modified.