in reply to Re^3: Value of a statement with modifier (unless)
in thread Value of a statement with modifier
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...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Value of a statement with modifier (unless)
by TimToady (Parson) on Jan 25, 2007 at 18:00 UTC |