in reply to about order in hash keys

The only way that you can predict the order is to build the hash, look at the order of the keys, and then expect that, if you continue using the exact same version of perl on the same hardware and building the hash in the same order, then the order of the keys will probably be the same in the future. This isn't terribly useful, though, since it doesn't allow you to control the order, even without the issue that the order is likely to change about 5 minutes after you start depending on it, if not sooner.

Personally, if I wanted to be able to retrieve from a hash in insertion order, I'd probably build a parallel array and push each new key onto it as it's inserted into the hash. Then I could use the hash itself for random access and look up the appropriate hash keys in the array for insertion-ordered access.