c:\@Work\Perl\monks>perl -wMstrict -le "use Data::Dump qw(pp); ;; for my $ar ( [ ], [ -1 ], [ -99 ], [ 0, -99 ], [ -99, 0 ], ) { my $idx = $ar->[0]; for (0..$#$ar) { $idx = $_ if( ($ar->[$idx]<0) || (($ar->[$_] >= 0) && ($ar->[$_] < $ar->[$idx])) ); } print qq{(@$ar) -> lnn index of }, pp $idx; } " () -> lnn index of undef (-1) -> lnn index of 0 Use of uninitialized value in numeric lt (<) at -e line 1. (-99) -> lnn index of -99 (0 -99) -> lnn index of 0 Use of uninitialized value in numeric lt (<) at -e line 1. Use of uninitialized value in numeric lt (<) at -e line 1. Use of uninitialized value in numeric lt (<) at -e line 1. (-99 0) -> lnn index of -99