Sure it is. Otherwise, you would not have had to wrap your example for loops in a sub to try to make your point.I wrapped it in a sub because that's one way to put a for loop in a non-void context. Note that the very fact that I am speaking of the "context" of a statement demonstrates that statements can be said to have return values. But also see the reply I'm about to make to Re^5: Unhappy returns.
@x = for (1) { 1 }; But, that's a syntax error. Why? Because statements don't return anything.No, it's a syntax error because the whole thing is a statement that is an expression (one of the possible kinds of statement), and the expression is a list assignment which has the form expression = expression. So all you've proved is that for (1) { 1 } isn't an expression. IMO by your argument, @x = do { for (1) { 1 } }; should be a syntax error, too, and it isn't.
In reply to Re^7: Unhappy returns
by ysth
in thread Unhappy returns
by tlm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |