3.2.11 chdir
chdir
This function changes the working directory to
chdir "$prefix/lib" or die "Can't cd to $prefix/lib: $!\n"; The following code can be used to move to the user's home directory, one way or another: $ok = chdir($ENV{"HOME"} || $ENV{"LOGDIR"} || (getpwuid($<))[7]); Alternately, taking advantage of the default, you could say this: $ok = chdir() || chdir((getpwuid($<))[7]); See also the Cwd module, described in Chapter 7, The Standard Perl Library , which lets you keep track of your current directory. |
|