in reply to System Command - Change Dir

Short answer, use chdir and your problem goes away. You're not doing error checking as perlstyle indicates, and that hides additional errors.

Here is a fuller explanation. The system command creates a new process that does something then exits. So if you have a system command that does a cd, the child process does a CD and goes bye bye. Which leaves the Perl process still in the original directory.

Actually it is a little worse than that. You're using both backticks and system. So you execute the command using backticks, and then the return from that (an empty string) is passed to system. Which then fails but you don't notice because you're not doing any error checking.

Anyways you need the changing directory to happen in the Perl process, and not in a temporary process that goes away. And that is why you have to use the built-in chdir instead.