in reply to chdir in perl

You're committing a cardinal sin, you're calling a function and not checking for success/failure.
chdir 'x:' or die "Something's wrong, couldn't chdir to x: ($!)";
Now, slap a slash on that chdir and you're all right.