XP is just a number | |
PerlMonks |
Re: How to change Current Shell's Pwd ?by Ytrew (Pilgrim) |
on Feb 07, 2005 at 07:04 UTC ( [id://428587]=note: print w/replies, xml ) | Need Help?? |
When you use backticks or the system() function, you're starting up a command shell for your operating system, changing the current directory of the command shell, then exiting the command shell and returning to perl. Perl's notion of the current directory doesn't change.
If you want the present working directory that perl uses to change, you need to use the chdir() function. In your example, you'ld want something like:
You might want to double check the documentation to see what the return value of chdir() is like, but I think that's right: then again, I'm typing from memory at 2:00 am. ;-)
Hope that helps,
In Section
Seekers of Perl Wisdom
|
|