The portability problem with $ENV{PWD} is that it assumes Unix. `pwd` also assumes Unix. The OP said "though I could replace the Cwd::cwd() calls with `pwd` (for Unix only), I'd prefer a more portable solution."
In addition, $PWD isn't a bashism. csh and ksh also populate it.
In reply to Re^4: Surprising behavior of Cwd module on Unix with symlinks
by DrHyde
in thread Surprising behavior of Cwd module on Unix with symlinks
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |