Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How to find the N largest values in an array?

by Anonymous Monk
on Oct 04, 2001 at 04:51 UTC ( [id://116611]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    
    ...
    my @sorted_list_o_num = sort { $b <=> $a } @list_o_num;
    my( $num_1, $num_2, $num_3 ) = @sorted_list_o_num;
    
  2. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    }
    @list_o_num;
    my @true_top_3 = sort { $b <=> $a } keys %list_o_num;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-03-29 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found