Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Sort hash ref of Hash of Hashes

by BioLion (Curate)
on Jul 06, 2010 at 10:34 UTC ( #848179=note: print w/ replies, xml ) Need Help??


in reply to Sort hash ref of Hash of Hashes

You are comparing string values 'PQRST' etc... but using the numerical sort (spaceship '<=>') operator. You should be using cmp. See sort for more info.

Just a something something...


Comment on Re: Sort hash ref of Hash of Hashes
Download Code
Replies are listed 'Best First'.
Re^2: Sort hash ref of Hash of Hashes
by moritz (Cardinal) on Jul 06, 2010 at 11:44 UTC
    ... and use warnings; would have warned you that Argument "PQRST" isn't numeric in numeric comparison (<=>) at ....

    So, always use warnings;. (Documented in perllexwarn).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2015-07-30 09:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls