Help for this page

Select Code to Download


  1. or download this
    sub get_max_index {  #revisit how to define functions/"my" var ? (defa
    +ult parameters?)
        my $imax=0;
    ...
               $imax=$_[$i] if ($imax<=$_[$i]);}
        return $imax;
    }
    
  2. or download this
    use strict;
    use warnings;
    ...
    my @arr = (1..10);
    my $ans = get_max_index(@arr);
    print"$ans\n";
    
  3. or download this
    use strict;
    use warnings;
    ...
    my @arr = (1..10);
    my $ans = get_max_index(\@arr);  #pass reference to array!
    print"$ans\n";