Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Mysterious hash behaviour

by davido (Cardinal)
on Apr 07, 2005 at 07:02 UTC ( [id://445558]=note: print w/replies, xml ) Need Help??


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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://445558]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-19 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found