Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: running backwards on a hash

by Maclir (Curate)
on Dec 11, 2001 at 20:59 UTC ( [id://130973]=note: print w/replies, xml ) Need Help??


in reply to running backwards on a hash

My question to you is:
What significance do you place on a particular ordering of the hash keys?
As others have stated, there is no particular logic to the sequence that keys(%hash) will return. And while that will remain constant while ever you make no changes to the contents of the hash itself, I certainly don't believe you can rely on them being in "arrival order".

Maybe what you need to determine first is why you need the values returned in a particular sequence, and you may find that a simple has (key / value) is not the data structure you require. Maybe a "hash of hashe", with the main key being some sequencing value (timestamp, transaction number, and so on), with the inner hash consisting of the values relating to that key.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (None)
    As of 2024-04-25 00:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found