Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^5: Short-circuiting a map list. (This works! But ...)

by BrowserUk (Patriarch)
on Oct 08, 2011 at 15:40 UTC ( [id://930364]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://930364]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2024-04-19 18:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found