in reply to I don't understand why keys %hash does this ...
You seem to expect to get the keys out of the hash in the same order you declared them. You won't. Hash keys are unsorted. You need to apply a sort if you need them in a specific order, or perhaps use an array of arrays data structure which would preserve the order.
cheers
tachyon
|
|---|