Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Best 20 after sort

by Taulmarill (Deacon)
on Oct 20, 2008 at 14:24 UTC ( #718239=note: print w/ replies, xml ) Need Help??


in reply to Best 20 after sort

Yes, like this:

foreach my $g( (sort {$Averages{$a} <=> $Averages{$b}} keys %Averages) +[0..19] ){ print $g,"\t",$Averages{$g},"\n"; }

The parenthesis surrounding the sort turn the return value into a list which can be sliced like an array.


Comment on Re: Best 20 after sort
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-08-29 20:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (288 votes), past polls