in reply to Mysterious hash behaviour

Yes, the explanation is that hashes do not maintain order. You can not count on the keys being in any particular order, unless you sort them too. This is documented behavior.

See perlintro: "Hashes have no particular internal order, though you can sort the keys and loop through them."


Dave

Replies are listed 'Best First'.
Re^2: Mysterious hash behaviour
by Anonymous Monk on Apr 07, 2005 at 08:15 UTC
    if the key is always an incremented integer, wouldn't an array be the appropriate data structure?