February 2012
Intermediate to advanced
1184 pages
37h 17m
English
chdir EXPR
chdirThis function changes the current process’s working directory
to EXPR, if possible. If
EXPR is omitted, $ENV{HOME} is used if set, and $ENV{LOGDIR} otherwise; these are usually the
process’s home directory. The function returns true on success, false
otherwise.
chdir("$prefix/lib") || die "Can't cd to $prefix/lib: $!";See also the Cwd module, which lets you keep track of your current
directory automatically.
On systems that support fchdir(2), you may
pass a filehandle or directory handle as
EXPR. On systems that don’t support
fchdir(2), passing handles raises a runtime
exception.
Read now
Unlock full access