http://www.perlmonks.org?node_id=477712

Tanalis has asked for the wisdom of the Perl Monks concerning the following question:

Update: Some more digging and I've answered my own question: Old Perl Behavior(TM). This behaviour was changed in Perl 5.6.1 (changelog) to make access to hash elements faster. More ammunition for the Update the Perl Version Campaign ... :)
I've been bitten this morning by some interesting behaviour when performing regular expression substitution on the values of a hash.

I'm used to being able to do something like

foreach( @array ) { s/something/something_else/g }
to an array, and expected a similar thing to work for hashes:
foreach( values %hash ) { s/something/something_else/g }
but it appears that this isn't the case. The substitution is performed, but on a copy of the original value, not a reference to it. Of course,
foreach( keys %hash ) { $hash{$_} =~ s/something/something_else/g; }
works as expected.

This interests me, and appears a little inconsistent. Is there some reason that my coffee-deprived brain can't see this morning for this inconsistency to exist?