Perl Monk, Perl Meditation | |
PerlMonks |
Re: exiting a subroutine neatlyby basiliscos (Pilgrim) |
on May 05, 2015 at 15:53 UTC ( [id://1125750]=note: print w/replies, xml ) | Need Help?? |
Try to use Guard (there are alternatives, but I'm satisfied with that one). So, your code would look like:
Please note, the scope guard will be executed even if your code dies somewhere after guard definition.
WBR, basiliscos.
In Section
Seekers of Perl Wisdom
|
|