in reply to Re: Ways to control a map() operation
in thread Ways to control a map() operation
This is a bit ambigous. As a matter of fact, you can leave eval{}, sub{} or do{} using last.
This is plain wrong. please wait for my update before answering.. thanks
Rather, you can combine eval, sub and last in some obscure way which will look like it's right and perl didn't complain (although it does).perl -le 'sub leave { last }; leave(1)' Can't "last" outside a loop block at -e line 1. perl -le '$foo = do { last }' Can't "last" outside a loop block at -e line 1. perl -le '$foo = eval { last if 1; 2; }; print $@ if $@; print ">$foo< +"' Can't "last" outside a loop block at -e line 1. ><
update: last exits the loop which is around such blocks immediately, thus works like a goto and is likely to leave a mess behind.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|