Looks like you can't put "next" inside an "eval". You can try to refactor the code and put the checking of the return value of the "sub" outside the eval block, e.g.:
#!/usr/bin/perl -lw use strict; use diagnostics; sub do_foo { die "err" if $_==2; $_!=4 } sub do_bar { "..."; } for (1..5) { my $flag = 1; eval { $flag &&= do_foo(); $flag &&= do_bar(); }; if ($@) { warn $@; next; } next if (!$flag); print; }
In reply to Re: "next" from within eval {} ?
by dwindura
in thread "next" from within eval {} ?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |