i guess that $p should keep the minimum value of the array, but the question is how to get its index.my $j = 1; my $p = $s[1]; #values are present starting from 1st index while ($j != $n - 1) { if (($p < $s[$j+1]) || ($p == $s[$j+1])) { }else{ $p = $s[$j+1]; } $j++; }
In reply to Re^4: index of the minimum element of the array
by Anonymous Monk
in thread index of the minimum element of the array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |