in reply to File::Copy::Recursive chokes on input

In scalar context, dircopy() returns the number of files copied. Are there actually files in the source directory?

The documentation isn't very clear but dircopy() returns undef if there is an error. So you actually should check to see if the return value is defined, not just true.

defined( dircopy($orig, $dest) ) or die "Copy failed: $!";

Or, actually check the return value.

my $files_copied = dircopy($orig, $dest); if (defined $files_copied) { print "Files copied: $files_copied\n" } else { die "Copy failed: $!"; }

Try that and see if that helps you figure out what's going on.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.