http://www.perlmonks.org?node_id=645644


in reply to Working directory oddity

Windows, right? It helps if you clarify when writing these questions :)

Possibly abs_path can help?

use strict; use warnings; use Cwd qw(abs_path); chdir("C:\WINDOWS\PROGRAM FILES"); # <- or whatever it is in windows. my $thisdir = abs_path('.'); print "This dir is $this_dir\n";

Untested (I'm in Linux), but that would be my first stab at this.

Replies are listed 'Best First'.
Re^2: Working directory oddity
by ikegami (Patriarch) on Oct 18, 2007 at 05:38 UTC

    Sorry, that doesn't work :( and not just cause your slashes are unescaped ;)
    getcwd, cwd and abs_path all return paths using the same caps provided to chdir (and with the slashes reversed to /).