in reply to Re^2: Ways to control a map() operation
in thread Ways to control a map() operation
You really cannot leave eval{} with a last.Oh yes, you can. But you will not only leave the eval but the loop around it, too. If there is no loop around that eval, you'll die—just like your code demonstrated.
The output of the above code is:eval { last; }; warn $@ || 'no error'; for (1) { eval { last; }; } warn $@ || 'no error';
By the way, even if the code in my previous post had died in the eval{}, the loop would have continued and the output would have been 123.Can't "last" outside a loop block at x.pl line 2. no error at x.pl line 11.
(++ for you anyway, because you almost tricked me into admitting that you're right :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Ways to control a map() operation
by Leviathan (Scribe) on Jul 16, 2006 at 11:41 UTC | |
by betterworld (Curate) on Jul 16, 2006 at 11:56 UTC | |
by Leviathan (Scribe) on Jul 16, 2006 at 12:19 UTC | |
by betterworld (Curate) on Jul 16, 2006 at 14:57 UTC | |
by Leviathan (Scribe) on Jul 16, 2006 at 16:12 UTC |