(Perl) change directory temporarily for a limited scope