Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by Jenda (Abbot)
on May 28, 2007 at 14:09 UTC ( [id://617843]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    while ($i--) {
      $max = $i if $data[$i] > $data[$max];
    }
    
  2. or download this
    my $max = 0;
    for (0 .. $#data) {
        $max = $_ if $data[$_] > $data[$max]
    }
    
  3. or download this
    my $max = 0;
    for (1 .. $#data) {
        $max = $_ if $data[$_] > $data[$max]
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://617843]
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-10-08 19:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (44 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.