in reply to Changing shell path inside perl script.

If I understand what you are asking, you want to know how to change the directory within perl and maintain that change once you've exited the script?

You likely cannot do this, since as the previous poster stated, because changes in a child process are not maintained in the parent; however, instead of trying to beat your head against the wall why not add a simple function to your .profile login script?

function mycd
{
     cd /to/your/new/path
}
then you could issue the following command at the UNIX prompt:
/usr/bin> mycd
/to/your/new/path>

or you could create a shell script and place it in a directory that is in your PATH.

#!/bin/ksh
cd /to/your/new/path
or if you're under Microsoft Windows you can create a mycd.bat file and place it in a directory that is in your PATH.
cd /to/your/new/path

metadoktor

"The doktor is in."

  • Comment on Re: Changing shell path inside perl script.