| Next | Program
Repair Shop ![]() |
24 |
How to keep the file lists from the various InputDIRs separate?
Another option: Do not mingle them in the first place
Have GrabFileList read just one directory at a time:
sub GrabFileList {
my $dir = shift;
opendir FILELISTDIR, $dir;
my @files = readdir FILELISTDIR;
closedir FILELISTDIR;
return @files;
}
This will necessitate calling it multiple times, and similar changes to CopyFiles:
for my $dir (@InputDIR) {
my @files = GrabFileList($dir);
# ...
CopyFiles($dir, @files);
}
This makes good sense, because both functions presently contain this for loop
By abstracting it out, we can remove the loop from both functions
This will result in a cleaner overall flow
| Next | ![]() |
Copyright © 2002 M. J. Dominus |