Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 wandering the Monastery: (5)
As of 2014-08-30 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls