Home: Perl Programming Help: Intermediate:
change directory when exiting perl

New User

Jan 19, 2010, 6:53 AM

Views: 652
change directory when exiting perl

I have written a perl script to navigate a UNIX file system. When the script exits you are left in the directory you started the script in. I would like to have the script leave me in the directory I navigate to when exiting. Any suggestions?


Jan 19, 2010, 11:09 AM

Views: 647
Re: [BTeal] change directory when exiting perl

In UNIX, each process is forked from their parent and inherits their environment. After that, they are independent. Any changes in either does not effect the other. To get a child process to run in the parent, you must . or source it. See `man bash` and search for /source/


I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".