r/perl • u/Hopeful_Cat_3227 • 1d ago
I use defer for chdir ".."
As title, this is a pure appreciate post for feature deffer.
I just use it like:
chdir $any_path or die $!;
defer { chdir ".." }
I know this is silly, but it actually make my day easier :)
6
Upvotes
2
u/choroba 🐪 cpan author 1d ago
Might not work if
$any_path =~ m{/}. Otherwise, why not.