for (...) { push @a, $_; } #### push @a, ...; #### my @a = ...; #### unless ( ($localtimenoformat - $mdtmnoformat) > 3600 ) { #### if ( ($localtimenoformat - $mdtmnoformat) <= 3600 ) { #### 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; #### push @files, $ftp->ls; my $new_file = 0; my $current_time_epoch = time; for my $file (@files) { if ( ($current_time_epoch - $ftp->mdtm($file) ) <= 3600 ) { $new_file = 1; last; } } envia_mail() if !$new_file; $ftp->quit or die $ftp->message;