Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: How to get 2nd highest value from an array?

by davidrw (Prior)
on Dec 13, 2005 at 22:37 UTC ( [id://516461]=note: print w/replies, xml ) Need Help??


in reply to How to get 2nd highest value from an array?

doesn't take into account short (or string/custom sorts) lists, but as a starting point:
my @arr = qw/ 1 9 8 7 6 2 3 4 5/; print ( (sort @arr)[-2] );

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-26 07:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found