for my $foo (@bar) { { cond1 ? next : action1(); cond2 ? next : action2(); cond3 ? next : action3(); } action_fallthough(); }
See perldoc on next under "Note that a block by itself is semantically identical to" or perlsyn and search for "Sorry. You can always put another block inside".
Simple example:
for (1..10) { print "$_ is an "; { next if $_ % 2; print "even "; } print "integer\n"; }
In reply to Re: Avoiding goto
by Anonymous Monk
in thread Avoiding goto
by elTriberium
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |