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

The behaviour is just as unspecified for a bare loop ({ ... }) as it is for a while loop (while (...) { ... }).

Replies are listed 'Best First'.
Re^5: Short-circuiting a map list. (This works! But ...)
by BrowserUk (Patriarch) on Oct 08, 2011 at 18:29 UTC
    If the last statement is a loop control structure like a foreach or a while , the returned value is unspecified.

    But the bare block is not the last statement.


    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.
      It's not the last statement of the sub, but it is the last statement of the do. What do you think do returns? The value to which the loop evaluates, which isn't defined.
        What do you think do returns?

        I know what the do returns:

        print do{ { print 'fred'; map $_,1 .. 10 } };; fred 1 2 3 4 5 6 7 8 9 10

        The result of the last statement inside the bare block.


        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.