--- name: chdir status: documented runtime: pp source: src/runtime/pp/directory.rs --- ```{index} single: chdir; Perl built-in (pp runtime) ``` # chdir ## Synopsis ```perl chdir("/tmp") or die "Cannot chdir: $!"; chdir($dir); chdir(); # changes to $HOME chdir(""); # also changes to $HOME ``` ## Description Changes the process's current working directory. Changes the working directory to the specified path. If called with no argument or an empty string, changes to the directory specified by the `HOME` environment variable (or `/` if `HOME` is not set). Returns 1 on success, `undef` on failure. ## See also mkdir, rmdir, Cwd, getcwd