in reply to Directory path and -d??

For a start, let us drop the -d test, in order to see things... See also Paladin's reply. But, there's still more going on.

Windows (and DOS) is a bit strange with regards to directories and drives: each drive has its own internal current directory. You can see it at the DOS prompt too: type cd d:\files for whatever directory that exists there, if your currently on drive C: you'll still see the path on C: as a prompt. You need to type D: to change that.

Run your script from that prompt, with C: as your current drive, and you'll see different files listed for every directory you chdir'ed to. Really.

In other Windows languages, you need to use a separate function call to change the current drive, and the current directory on a drive.

You commonly don't notice anything in Perl, because chdir (and Cwd's cwd) changes/report both drive and directory at once.

Conclusing: even in Perl, don't use "d:"; use a full path, like "d:\\" or "d:/", "d:\\files" or "d:/files".

Replies are listed 'Best First'.
Re: Re: Directory path and -d??
by pen (Acolyte) on Sep 24, 2003 at 13:50 UTC
    I have now discovered the creation of paths but thanks for confirming this for me. I am not using File::Find as I have made my code work and am now using one of the prefered ways. I have learned allot about the syntax by just doing these simple tests.

    Thanks for all the help
    Paul Neale