Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How can one find five max values and five min values with positions in descending and ascending order from arrays?

by LanX (Saint)
on Apr 26, 2013 at 08:34 UTC ( [id://1030792]=note: print w/replies, xml ) Need Help??


in reply to How can one find five max values and five min values with positions in descending and ascending order from arrays?

What did you try?

DB<103> @h{@y}=@x => ("c", "d", "e", "f", "k", "l", "m", "n") DB<104> @h{(sort @y)[0..4]} => ("f", "n", "c", "e", "d") DB<105> @h{(sort @y)[-5..-1]} => ("e", "d", "l", "m", "k")

Cheers Rolf

( addicted to the Perl Programming Language)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1030792]
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: (2)
As of 2024-03-19 06:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found