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

Re: sorting Array of hashes

by Happy-the-monk (Monsignor)
on Apr 03, 2012 at 08:48 UTC ( #963195=note: print w/ replies, xml ) Need Help??


in reply to sorting Array of hashes

Why do you want to stort it?

The hash just stores your data, when you have it printed out, that's just one particular form of representation.
(An internal quirk if you will.)

You may need sorting when you extract the data from the hash then.

Your example looks a bit like Data::Dumper output. If my assumtion is right, setting $Data::Dumper::Sortkeys = 1; will probably do what you want.

If it is more complicated, you will have to use the sort funtion.

Cheers, Sören


Comment on Re: sorting Array of hashes
Re^2: sorting Array of hashes
by balajinagaraju (Sexton) on Apr 03, 2012 at 09:17 UTC
    Hi, Thanks a lot for your suggestions , @soren adding this statement $Data::Dumper::Sortkeys = 1 in my program worked like charm...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (12)
As of 2014-09-23 18:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (238 votes), past polls