my $new_file = 0; for $file ($ftp->ls){ push @files, $file; } for $file (@files) { $localtimenoformat=time; $mdtmnoformat=$ftp->mdtm($file); unless ( ($localtimenoformat - $mdtmnoformat) > 3600 ) { print "$file"; print "Localtime No Format = $localtimenoformat"; print "MDTM No Format = $mdtmnoformat\n"; $new_file = 1; } } envia_mail() unless $new_file; $ftp->quit or die $ftp->message;