Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: min and mindex

by tinita (Parson)
on Nov 07, 2012 at 00:03 UTC ( #1002606=note: print w/ replies, xml ) Need Help??


in reply to min and mindex

use List::Util qw/ reduce /; my $min_index = reduce { $array1[$a] <= $array1[$b] ? $a : $b } 0 .. $ +#array1; say <<"EOM"; min element: $array1[ $min_index ] min index: $min_index array2: $array2[ $min_index ] EOM


Comment on Re: min and mindex
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2015-07-06 17:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls