4 ms·
Thanks for the reply. I don't argue that it's not to spec, just that it seems not useful/a bit surprising. Some other languages (e.g. perl and I think also jav
by jbert 14y ago
Thanks for the reply. I don't argue that it's not to spec, just that it seems not useful/a bit surprising.
Some other languages (e.g. perl and I think also java) choose to make the loop var an alias, rather than a copy, to allow mutation:
for my $item (@items) {
$item->frob; # Can happily mutate the item
}
will work as it reads.