in reply to assignment to hash with duplicates in list context (bug?)
G'day LanX,
I can't reproduce this with v5.18.1 (darwin-thread-multi-2level):
$ perl -MData::Dumper -e ' %h1=(3 => 1, 5 => 1, 10 => 3 ); @l=%h2=reve +rse %h1; print Dumper \@l,\%h2' $VAR1 = [ 1, '3', 3, '10' ]; $VAR2 = { '1' => '3', '3' => '10' }; $ perl -MData::Dumper -e ' %h1=(3 => 1, 5 => 1, 10 => 3 ); %h4=%h3=%h2 +=reverse %h1; print Dumper \%h2,\%h3,\%h4' $VAR1 = { '1' => '3', '3' => '10' }; $VAR2 = { '1' => '3', '3' => '10' }; $VAR3 = { '1' => '3', '3' => '10' };
In v5.18.0, there were changes to hashes (see perl5180delta: Hash overhaul). This meant that running these one-liners (potentially) produced different results each time. I ran these a few times: I got different results as expected but none reproduced what you're seeing. Here's some examples of this:
-- Ken
|
|---|