T.S. Ravi Shankar wrote:
> Hi all :
>
> Could anyone tell me how I could move between the directories ( or
> change the present working directory ) with any perl command ??
>
> I have tried these   system '/bin/cd $HOME'; ,   chdir '$HOME'; ,
> exec 'cd $HOME';
>
> After I execute the perl code, the PWD still remains unchanged.
>
> If the above ways are incorrect, please direct me to the correct.

Hi Ravi.

As John pointed out (but not in so many words) the built-in 'chdir'
will change the default directory for your script, but won't change
the PWD environment variable. The standard 'Cwd' module gives you two
alternative ways around this. It will provide a 'cwd' function
which will return the value of your current default directory, or
(when incorporated with 'use Cwd "chdir"') will give you an alternative
'chdir' function which behaves identically to the built-in one but
keeps the value of PWD in synch with your current location.

HTH,

Rob






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to