in reply to chdir and security

. . .it's better to chdir directly and check the return value to see if it succeeded; this helps to avoid race conditions.

Depending on your needs, you might also wish to check that the canonical absolute path to your current directory after the chdir() matches what you expect. You can do that with `pwd -P` or, presumably more portably:

use Cwd; my $cwd = getcwd();

-sauoq
"My two cents aren't worth a dime.";