7.2.7 Cwd - Get Pathname of Current Working Directoryuse Cwd; $dir = cwd(); # get current working directory safest way $dir = getcwd(); # like getcwd(3) or getwd(3) $dir = fastcwd(); # faster and more dangerous use Cwd 'chdir'; # override chdir; keep PWD up to date chdir "/tmp"; print $ENV{PWD}; # prints "/tmp"
It is recommended that one of these functions be used in all code to ensure portability because the pwd program probably only exists on UNIX systems.
If you consistently override your
chdir
built-in function in all
packages of your program, then your |
|