in reply to Newbie: need algorithm to evaluate no file exist
One solution would be to set a flag if a new file is found and test that flag after the loop, like:
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Newbie: need algorithm to evaluate no file exist
by ikegami (Patriarch) on Aug 18, 2010 at 15:29 UTC | |
by Anonymous Monk on Aug 18, 2010 at 15:39 UTC | |
by locked_user sundialsvc4 (Abbot) on Aug 18, 2010 at 15:53 UTC | |
|
Re^2: Newbie: need algorithm to evaluate no file exist
by Anonymous Monk on Aug 18, 2010 at 15:34 UTC | |
by kennethk (Abbot) on Aug 18, 2010 at 16:02 UTC |