Mr. Sudharshan, Very thanks for your quick reply !
So do you say that it is not possible through any means to change the directories (since we are moving between the shells) ? ( I was trying to build PERL equivalents of pushd & popd (Unix utilities by using cd inside the perl script ). Hence I was thinking of doing all "chdir"s inside the perl script with "system-cd"s ) Please let me know if you have any workarounds for this !! Thanks again, Ravi 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. > This is roughly how shell executes commands, 1) fork a child process 2) exec the command in the child Your option 1) system '/bin/cd $HOME' This will create a sub shell from within your perl script and change it's current working directory. Result: The cwd of your perl script process remains the same and so does it's parent's Your option 2) chdir '$HOME' The single quote will not expand the scalar $HOME, I guess this call should have failed. chdir $HOME is what you are looking for. Result: This will change the cwd of your perl script process not it's parent's Your option 3) exec 'cd $HOME' This will overlay you perl process' image, but the parent's cwd will still not change. cd is a shell built-in. It is not an external command. We can help you better, if you explain why you are doing this > >If the above ways are incorrect, please direct me to the correct. > >Thanks, >Ravi > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]