in reply to "next" from within eval {} ?
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: "next" from within eval {} ?
by dwindura (Novice) on Dec 16, 2011 at 10:28 UTC | |
by Anonymous Monk on Dec 16, 2011 at 12:22 UTC |