http://www.perlmonks.org?node_id=111415

Corrupt_SYN has asked for the wisdom of the Perl Monks concerning the following question:

I tried the obvious
system "cd $dir";
But this seems to have no effect.
How do I change directory within a perl program?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How do I move into a directory?
by blakem (Monsignor) on Sep 10, 2001 at 14:23 UTC
    See the chdir function.

    Originally posted as a Categorized Answer.

Re: How do I move into a directory?
by davis (Vicar) on Sep 26, 2001 at 19:41 UTC
    Use chdir. You might find the Cwd module useful as well; it will (optionally) override the built-in chdir function with one which keeps the "current working directory" (cwd) in sync.