星期一, 12月 10, 2007

Changing the working directory

In the shell you would type "cd /home" to change the workingdirectory to /home. You could write the following in your Perl script:

system("cd /home");

But it would have no effect. In fact, since the system call forksfrom the process used by the interpreter, it doesn't change the workingdirectory of your script. Instead, you can use a Perl function called"chdir":

chdir "/home";

http://www.linuxforums.org/programming/learn_perl_in_10_easy_lessons__lesson_5.html

沒有留言: