Hehe, after a comment from
btrott and a cold shower I realized I answered the wrong question. Oh well :)
You probably don't need recursion in your algo if you use a
File::Copy/
File::Find combo like this:
use strict;
use File::Copy qw/copy/;
use File::find qw/find/;
sub rcopy {
my $src = shift;
my $dst = shift;
find(sub {
my ($src_file, $dst_file) =
($File::Find::fullname, $File::Find::fullname);
$dst_file =~ s!^$src!$dst!;
copy $src_file, $dst_file
or die "Could not copy $src_file => $dst_file:$!";
}, $src);
}