my $oldest; my $oldtime = 0; for (glob "$dir/*.pl") { my $thistime = -C; if ($thistime > $oldtime) { ($oldest, $oldtime) = ($_, $thistime); } } #### use List::Util 'reduce'; my $file = (reduce {$a->[0] < $b->[0] ? $a : $b} map {[(stat)[10],$_]} glob '*.pl' )->[1]; #### my $file = reduce {(stat $a)[10] < (stat $b)[10] ? $a : $b} glob '*.pl';