Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: index of the minimum element of the array

by InfiniteSilence (Curate)
on Jan 17, 2014 at 14:20 UTC ( [id://1070965]=note: print w/replies, xml ) Need Help??


in reply to index of the minimum element of the array

Here's one way

perl -e 'use List::Util qw|min|; $pos = 0; @a = qw|95 41 3 9 2|; %ha +shPos = map {$_=>$pos++} @a; print $hashPos{scalar min @a};' Prints 4

Celebrate Intellectual Diversity

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-23 10:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found