in reply to Why does File::Find chdir?

The reason I ask is that a long time ago I used File::Find and I tried to limit the number of files found by dying after n found files. In that situation, the side effect became a problem.
Use Cwd to get the current directory before the call to File::Find. chdir back to that directory after you've finished.

File::Find already makes use of Cwd anyway, so there's no overhead of using that module yourself.

Replies are listed 'Best First'.
Re^2: Why does File::Find chdir?
by jplindstrom (Monsignor) on Jul 13, 2004 at 14:13 UTC
    At the time I was thoroughly confused by the behaviour, which forced me to read the man page a little better. The no_chdir option solved the problem for me nicely.

    (Changing directory there and back seems more brittle than just leaving it alone.)

    /J