in reply to Re: Avoiding goto
in thread Avoiding goto
The down side is that last becomes equivalent to next (unless you use a label).
$ perl -le'for (1..2) { { print; last; } cleanup; }' 1 2
The up side is that it solves the following problem nicely:
$ perl -Mstrict -e'for (@ARGV) { my $x; } continue { cleanup($x) }' Global symbol "$x" requires explicit package name at -e line 1. -e had compilation errors.
|
|---|