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

Re: How can I find the index of the biggest element in an array?

by satchboost (Scribe)
on Mar 14, 2001 at 22:16 UTC ( [id://64442]=note: print w/replies, xml ) Need Help??


in reply to How can I find the index of the biggest element in an array?

my $index = 0; my $maxval = $myarray[ my $index ]; for ( 0 .. $#myarray ) { if ( $maxval < $myarray[$_] ) { $index = $_; $maxval = $myarray[$_]; } } print "Max is index $index: $myarray[$index]\n";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-19 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found