note
moritz
<p>Well, if hash values weren't lvalues, <c>$h{1} = 2</c> wouldn't work. There's no reason why they shouldn't be lvalues when using the whole hash in list context. And any lvalues can be aliased, otherwise <c>$_++ for ...</c> could never work.</p>
<p>I'm not sure those things are explicitly documented somewhere.</p>
<p>The thing that surprises me though is that trying to increment the hash keys doesn't die like this one:</p>
<code>
$ perl -wE 'my $x; $_++ for ($x, 1)'
Modification of a read-only value attempted at -e line 1.
</code>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-616540">
[http://perl6.org/|Perl 6 - the future is here, just unevenly distributed]
</div></div>
1019799
1019799