in reply to index of the minimum element of the array

The "classical way" is to set up a variable for $min, and a variable for $min_index, then to iterate through your array by index, and any time the element at a given index is less than $min, set $min equal to that element, and $min_index equal to the current index. At the end of the loop, $min_index will contain the correct value. In Perl, undef is less than any defined value, so you don't strictly need to deal with explicitly populating $min on the first iteration, or doing a definedness check, but you will get some warnings if you don't test definedness first.

That's the classical method; the one taught to beginning programmers almost regardless of which language they're using as the means of learning programming. And it's probably the method you've discussed in class. If the class discussion was inadequate, a little searching might have turned up How can I find the index of the biggest element in an array?, which provided some good solutions which can be adapted to find the minimum instead pretty easily. Here's one based on GrandFather's answer in that thread:

my @array = ( 1, 5, 7, 9 ); sub minindex { my( $aref, $idx_min ) = ( shift, 0 ); $aref->[$idx_min] < $aref->[$_] or $idx_min = $_ for 1 .. $#{$aref}; return $idx_min; } print minindex(\@array), "\n";

Dave