Indeed, thanks for posting; I have now modified Perl 6 to fix this problem today--it no longer returns the last expression evaluated, but the value of the last statement in the block. Happily, fixing this (and a few other things) also makes list comprehensions a lot easier to write now.
How will that work with a for modifier? I've occasionally wanted
$t += $_ for @list;
to return the last value of $t. Okay, okay, I know in Perl 6 there will be other ways to do similar stuff, in particular functional-language like ones that will avoid the need for a temporary variable altogether, but I still wonder how this kind of situation will be handled...
In reply to Re^4: Value of a statement with modifier (unless)
by blazar
in thread Value of a statement with modifier
by Jenda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |