in reply to Re^2: statement vs. block?
in thread statement vs. block?

Maybe I'm not getting what the OP is asking for. I read "any piece of code that would run unchanged as a statement or a block, that would behave differently in one relative to the other" as some stuff such that "map {stuff } @any" doesn't do the same thing as "mapstuff, @any" (but does run). I provided that.

Replies are listed 'Best First'.
Re^4: statement vs. block?
by Fletch (Bishop) on Apr 12, 2008 at 00:13 UTC

    Right, but the difference in your example is because of the precedence affecting powers of parens. Your examples have fallen afoul of the "if it looks like a function call it is one" rule (see perlfunc). It's the difference between print (42+23)*2; and print +(42+23)*2;; the parens change where the LIST of arguments to the list operator begin.

    (Not that you're wrong; it is a case where the literal code is different. I just wanted to point out that the difference is because of what the actual parsed code works out to be rather than it being that stuff is behaving different as map EXPR, LIST versus how map BLOCK LIST would, which I think was what's being asked.)

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.