in reply to hoh - print in the inserted order

There is one caveat when using Tie::IxHash: although order is preserved when adding new key - value pairs, the keys must be unique. If you add a duplicate key, the value is changed, but the order of the original key is retained. This may or may not be what you want.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James