Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Save the resultant of " hash sorted by values "

by ikegami (Patriarch)
on Mar 23, 2011 at 19:47 UTC ( [id://895103]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub ip_to_key { sprintf "%03d", split /\./, $_[0] }
    
    my @sortedKeys =
        sort { ip_to_key($ipaddr{$a}) cmp ip_to_key($ipaddr{$b}) }
        keys %ipaddr;
    
  2. or download this
    my @sortedKeys =
        map substr($_, 4),
        sort
        map pack('C4', split(/\./, $ipaddr{$_})) . $_,
        keys %ipaddr;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2024-04-23 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found