in reply to cloning a directory tree

mkpath() takes a list of directories, so this:

foreach my $dir(@dirs){ mkpath("$to/$dir"); }

Can be changed to:

mkpath(@dirs);

But that will only work if $to is prepended to each file name in @dirs. Change your find() to this:

find (sub {push @dirs => $to . '/' . $File::Find::name if -d},$from);

Unless there's something I'm missing.