Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Crazy hash sorting issue.

by kirbyk (Friar)
on Nov 04, 2005 at 18:15 UTC ( #505821=note: print w/ replies, xml ) Need Help??


in reply to Crazy hash sorting issue.

TMTOWTDI, of course, but how about:

foreach my $key (sort { substr($hash{$a}, -2) cmp substr($hash{$b}, -2 +) } keys %hash) { print $key . ' ' . $hash{$key} . "\n"; }
Tested, seems to work.

-- Kirby, WhitePages.com


Comment on Re: Crazy hash sorting issue.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-12-21 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (109 votes), past polls