Next | Program Repair Shop | 52 |
The big problem here is the argument passing again
FindLastOut depends on global variables $LastOut and $OutputDIR
$OutputDIR should be an argument
What about $LastOut?
No need---it is always 0!
sub FindLastOut { my $OutputDIR = shift; opendir (FINDLASTOUT_OUT,$OutputDIR); my @Files = readdir (FINDLASTOUT_OUT); closedir (FINDLASTOUT_OUT); my $Highest = 0; foreach my $File (@Files) { next if $File eq '.' || $File eq '..'; next if $File !~ /\d/; if (int(substr($File,0,5)) >= $Highest) { $Highest = int(substr($File,0,5)); } } return $Highest; }
Also some minor changes in the bottom half of the function
Next | Copyright © 2002 M. J. Dominus |