Anonymous Monk,
While there is a
module that has just the function you are looking for, your second question leads me to offer the "low water mark" solution.
#!/usr/bin/perl
use strict;
use warnings;
my @list = qw(4 78 3 89 4 1000 5);
my %minimum;
for my $index ( 0 .. $#list ) {
@minimum{ qw(index min) } = ($index , $list[$index]) if ! %minimum;
if ( $list[$index] < $minimum{min} ) {
@minimum{ qw(index min) } = ($index , $list[$index]);
}
}
print "The index of the smallest number is : $minimum{index}\n";
print "The valud of the smallest number is : $minimum{min}\n";
Cheers -
L~R