use strict; my $mytime=(time); my ($File,$FileStat,$CallOutDir); opendir(CallOut, $CallOutDir) || die "$!\n"; foreach $File (readdir(CallOut)) { next if $File=~/^\./; if ($FileStat = (stat $File)[9]){ if ($FileStat <= ($mytime - 1200)) { print "File older than 20min found. The file name is $File"); #send mail here.... last; } } }