in reply to Current Directory in Windows

Maybe this will help you?

c:\>type test\junk.pl print $^X, "\n", $0; c:\>perl test\junk.pl C:\Perl64\bin\perl.exe test\junk.pl

If you extract the path from $^X that will tell you where the executable (perl.exe) was run from.

And if you add the path component from $0 the cwd, that will tell you where the script was run from.

There are probably some exceptional circumstances where one or other of those won't be true, but they are rare enough to discount for most purposes.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?