in reply to Re^7: printing unitialized value of the 'do BLOCK'
in thread printing unitialized value of the 'do BLOCK'

And there we go. The reason the value is only defined when the last statement is an expression.

  • Comment on Re^8: printing unitialized value of the 'do BLOCK'

Replies are listed 'Best First'.
Re^9: printing unitialized value of the 'do BLOCK'
by rsFalse (Chaplain) on Dec 18, 2019 at 23:26 UTC
    I thought that '1' is also expression.

      But the return value is only defined when the last statement is an expression. The last statement is an unless statement, so the return value is undefined.

      We were discussing what value is returned even though it's undefined. But that's always dangerous. As you've pointed out, it doesn't always work.

      Update: Fixed typo (until=>unless)

        The last statement is unless, not until. Of course, both are conditionals, so I wouldn't bet on the return value anyway.
        I'm not sure I understand. But nevermind.