in reply to Problem with opendir/readdir on Win2k

Thanks to all monks who responded. It is not a bug after all, and I did miss something subtle.

Corion pointed out that command.com and cmd.exe keep a current directory for every drive - I knew that from experience.
japhy added that in Windows (aka command.com and cmd.exe), typing dir c: lists the current directory of drive c: - I never noticed that before.
Hence my erroneous belief that typing dir c: would list the root directory.

This being so, it makes sense that Perl's opendir("c:") opens the current directory of drive c:, not the root directory.

I also looked into Perl sources (AS build 618). In win32\win32.c: win32_opendir() I found the code that performs the mapping "c:" to "c:./":
/* bare drive name means look in cwd for drive */ if (len == 2 && isALPHA(scanname[0]) && scanname[1] == ':') { scanname[len++] = '.'; scanname[len++] = '/'; }
The C comment says what the code does, but not why. japhy explained why.

Rudif

PS The conclusion ought to be RTFM, except that I still don't know which FM I should have read.