Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Sorting a hash in a predetermined order

by dasgar (Priest)
on Nov 17, 2015 at 23:33 UTC ( #1147965=note: print w/replies, xml ) Need Help??


in reply to Sorting a hash in a predetermined order

I would like to order the output in the order in which I fill the hash as listed above...

That kind of sounds like you're wanting an ordered hash. My first thought on that was Tie::IxHash. In looking for the link for that module, I stumbled across another module that does something similar and it had a link to yet another module (Hash::Ordered). The documentation for Hash::Ordered has links to other similar modules as well as some benchmarks run by its author comparing the different modules that provide an ordered hash.

Of course, based on your full description, I'm thinking that choroba's suggestion would be what I probably would go with.

  • Comment on Re: Sorting a hash in a predetermined order

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2022-12-08 12:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?