Jump to content

Perl Programming/Keywords/chdir

From Wikibooks, open books for an open world
Previous: caller Keywords Next: CHECK

The chdir keyword

[edit | edit source]

chdir changeds the working directory to the new destination in EXPRESSION. Without EXPRESSION, it changes to the directory defined in $ENV{HOME}, if set. If this is also not set, it changes to $ENV{LOGDIR}. (On VMS, $ENV{SYS$LOGIN} is also checked.)

chdir returns true on success and false otherwise.

If the operating system supports fchdir(2), a DIRHANDLE or FILEHANDLE can also be used. If this is not the case, an exception is raised.

Syntax

[edit | edit source]
  chdir DIRHANDLE
  chdir EXPRESSION
  chdir FILEHANDLE
  chdir

Examples

[edit | edit source]
chdir \
chdir closedir mkdir opendir readdir rewinddir rmdir seekdir telldir
Previous: caller Keywords Next: CHECK