Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Effective sort method?

by l.frankline (Hermit)
on Jan 03, 2006 at 06:40 UTC ( [id://520512]=note: print w/replies, xml ) Need Help??


in reply to Effective sort method?

here the Solution:

my %hash = ( 1 => [1, One], 2 => [2, Two], 3 => [3, Three], 4 => [4, Four], 5 => [5, Five], 6 => [6, Six], 12 => [12, Twelve], ); my @sort; for my $key (sort (keys %hash)) { push @sort, "$hash{$key}[0]::$hash{$key}[1]"; } my @new = sort { $a <=> $b } @sort; for (@new) { my ($int, $alpha) = split(/::/, $_); print "Integer is: $int -- Alpha is: $alpha\n"; }

regards,
Franklin

Don't put off till tomorrow, what you can do today.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2024-04-24 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found