Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL chdir Function



Syntax

chdir EXPR

chdir


Definition and Usage

Changes the current working directory to EXPR, or to the user's home directory if none is specified. This function call is equivalent to Unix command cd EXPR.

Return Value

  • 0 on failure

  • 1 on success

Example

Assuming you are working in /user/home/tutorialspoint directory. Execute following program:

#!/usr/bin/perl

chdir "/usr/home";

# Now you are in /usr/home dir.

chdir;

# Now you are in home directory /user/home/tutorialspoint


Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names