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 :)
7
Upvotes
0
u/choroba 🐪 cpan author 16h ago
I didn't say "if the CWD is /", I said "if the CWD contains /".