in reply to Re^4: Short-circuiting a map list. (This works! But ...)
in thread Short-circuiting a map list.

do does say "do BLOCK" does *not* count as a loop,

I don't think that is relevant as it is the anonymous block inside the do block that is the target of the last?

I can also get the same output with the same weirdness whilst avoiding the do block:

sub b{ my $x = shift; goto sub { { print 'ba'; map { print 'bb'; last if $_ == $x; $_; } @_; print 'bc'; } }; } my @data = 0 .. 9; print for b( 5, @data );

I am completely at a loss to explain the return values being stacked on top of the passes values?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^6: Short-circuiting a map list. (This works! But ...)
by Anonymous Monk on Oct 08, 2011 at 15:49 UTC

    I don't think that is relevant as it is the anonymous block inside the do block that is the target of the last?

    I am completely at a loss to explain the return values being stacked on top of the passes values?

    Me too , except the aforementioned warning regarding unspecified behavior with loop control structure -- if you can last it, its a loop