in reply to Is any simple way to get the current directory name?

Note: Bad answer about using $ENV{PWD} removed (instead of using my whiteout).

Use Cwd.

Replies are listed 'Best First'.
Re: Re: Is any simple way to get the current directory name?
by jsegal (Friar) on Jul 15, 2002 at 17:53 UTC
    The problem with $ENV{PWD} is that it doesn't stay "linked." i.e.
    print $ENV{PWD},"\n"; chdir("..") print $ENV{PWD},"\n";
    will print the same thing twice, which is probably not what you want. (If you use Cwd and ask it to override chdir, it will automatically keep $ENV{PWD} in sync with the actual current working directory, but by default it is not kept in sync).

    --JAS