in reply to perl & UNC paths
chdir($outdir) or die "Unable to chdir to '$outdir': $!\n";
Most likely your first chdir() is failing.
-sam