On 6 Oct 2004, at 17:50, Rafael Garcia-Suarez wrote:
Boris Zentner (via RT) wrote:lisa:~ borisz$ perl -MData::Dumper -le '%h = (1 => 2, a=>"b", c => 2); %h = reverse ( %x = reverse %h); print Dumper({x => \%x, h =>\%h});' $VAR1 = { 'h' => { '' => 2 }, 'x' => { 'b' => 'a', '2' => 'c' } };
Note that %h is damaged now. I really expect to loose the dupes.
Another "stuff on the stack is not refcounted" bug ?
I am not so sure. I do not have a blead perl to run right now, but compare
perl -MDevel::Peek -e '%h = (1 => 2, a=>"b", c => 2); Dump($_) for @x = reverse %h'
perl -MDevel::Peek -e '%h = (1 => 2, a=>"b", c => 2); Dump($_) for %x = reverse %h'
It seems that what is left on the stack after a hash assign in a list context is bad.
But reading the code it seems to me that the code above would not do what the user expected anyway. The code in pp_aassign looks like it is trying to do the same thing regardless of the LHS being an array or a hash. So it would seem the stack would have the same contents as the RHS and not whats left after the hash assignment had removed duplicates.
Graham.