Next | Program Repair Shop | 88 |
31 $source_node = $pwd.'/'.$source_node;
32 ( my $relative_node ) = $source_node =~/$source_directory(.*)/;
Remember this?
The arguments are $src, the path of the source directory, and $dst, the path of the destination directory.
But that means that the source file is simply
"$src/$source_node"
And the destination file is
"$dst/$source_node"
That is a lot simpler!
$source_node looks funny in a destination filename
Let's just call it $file:
my ($src_file, $dst_file) = ("$src/$file", "$dst/$file");
3 lines become 1
Also, the program now works even when $source_directory contains a regex metacharacter
Next | Copyright © 2002 M. J. Dominus |