in reply to Re: "next" from within eval {} ?
in thread "next" from within eval {} ?
Just realized that my solution is different with what you want. In mine, it will still execute do_bar, eventhough do_foo returns false. The only way that I can think to break from eval is to raise an exeception, e.g.:
#!/usr/bin/perl -lw use strict; use diagnostics; sub do_foo { die "err" if $_==2; $_!=4 } sub do_bar { "..."; } for (1..5) { eval { die 'next please' unless do_foo(); die 'next please' unless do_bar(); }; if (my $e = $@) { warn $e if ($e !~ /^next please/); next; } print; }
Hope this is what you are looking for
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: "next" from within eval {} ?
by Anonymous Monk on Dec 16, 2011 at 12:22 UTC |