use File::chdir; print $CWD; # now cd and show me a directory listing { local(@CWD,$CWD); push @CWD,'subdir'; print $CWD; print join("\n", glob '*'); } # now we're back where we started. We'll do a listing to show. print $CWD; print join("\n", glob '*'); #### use File::chdir; my $wd = $CWD; chdir('subdir'); # do some work. $CWD = $wd; # return to saved dir.