Steve Fink wrote:
>
> So, why not get rid of the specialness? Why can't all blocks return
> their last value?
>
> Then we would have sub BLOCKs and loop BLOCKs. 'return' would escape the
> nearest enclosing sub BLOCK and return a value. last/redo/next would
> escape/repeat/continue the enclosing BLOCK of any sort...
>
> Oh yeah. do BLOCK is still a third kind, which is transparent to all
> control constructs.
I think any block which currently can "return" a value by letting it
fall out the end should be able to return a value by using C<return>
explicitly. I can count how many times I've wanted to -- and thought
I should be able to -- do something like the following:
@x = map {
/:/ and return( $`, $' );
/,/ and return( $`, $' );
()
} @y;
O.k., ignore the stupidness of the example. Point is, I can't
return a value "early" from the loop.
--
John Porter
We're building the house of the future together.