Next | Program Repair Shop | 39 |
my $command = "cp $dir/$file $dir/$NextOut/$file";
It's easy to make $NextOut into an argument
The obvious change makes the call back in the main program:
CopyFiles($dir, $NextOut, @files);
But we can do better:
# Usage: CopyFiles(source_dir, destination_dir, files....)
CopyFiles($dir, "$dir/$NextOut", @files);
This is simpler and more flexible
It can now copy files from anywhere to anywhere
We might even reuse this function someday
Next | Copyright © 2002 M. J. Dominus |