- 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;
}
- or download this
use strict;
use warnings;
...
my @arr = (1..10);
my $ans = get_max_index(@arr);
print"$ans\n";
- or download this
use strict;
use warnings;
...
my @arr = (1..10);
my $ans = get_max_index(\@arr); #pass reference to array!
print"$ans\n";