push @files, $ftp->ls; my $new_file = 0; my $current_time_epoch = time; for my $file (@files) { my $modified_time_epoch = $ftp->mdtm($file); if ( ($current_time_epoch - $modified_time_epoch) <= 3600 ) { print "$file\n"; print "Current time = $current_time_epoch\n"; print "MDTM = $modified_time_epoch\n"; $new_file = 1; } } envia_mail() if !$new_file; $ftp->quit or die $ftp->message;