in reply to system pwd

I was about to point out that you are likely to have an environment variable on hand for this -- e.g. with a bash shell, I can use "$ENV{PWD}" -- but there are some problems with this:

It turns out that jkahn's advice to "use Cwd;" is absolutely right -- and for my own sake, I'm glad to have learned how right it is:

cd /home/graff perl -e 'use Cwd; $,=" "; print $ENV{PWD},getcwd,$/; chdir "/tmp"; print $ENV{PWD},getcwd,$/;'
As the output shown below makes clear, Cwd::getcwd always returns the true current directory:
/home/graff /home/graff /home/graff /tmp