-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
weird results from reverse( %x = reverse %h ) #7526
Comments
From bzm@2bz.deCreated by bzm@2bz.delisa:~ borisz$ perl -MData::Dumper -le '%h = (1 => 2, a=>"b", c => 2); Note that %h is damaged now. I really expect to loose the dupes. Some more opinions here: Perl Info
|
From @rgsBoris Zentner (via RT) wrote:
Another "stuff on the stack is not refcounted" bug ? |
The RT System itself - Status changed from 'new' to 'open' |
From rick@bort.caOn Wed, Oct 06, 2004 at 06:50:17PM +0200, Rafael Garcia-Suarez wrote:
I dunno, but some more data points: $ perl5.8.3 -le 'print (%x = ("a",1,"b",2,"b",3));' I'm not sure what it should print but those are both obviously wrong. -- |
From @gbarrOn 6 Oct 2004, at 17:50, Rafael Garcia-Suarez wrote:
I am not so sure. I do not have a blead perl to run right now, but perl -MDevel::Peek -e '%h = (1 => 2, a=>"b", c => 2); Dump($_) for @x = perl -MDevel::Peek -e '%h = (1 => 2, a=>"b", c => 2); Dump($_) for %x = It seems that what is left on the stack after a hash assign in a list But reading the code it seems to me that the code above would not do Graham. |
From @demerphq
Maybe its also OS specific? On Win32 I couldn't repeat this behaviour using D:\Development>perl -le "print (%x = (qw(a 1 b 2 c 3)));" D:\Development>perl -v This is perl, v5.6.1 built for MSWin32-x86-multi-thread Copyright 1987-2001, Larry Wall Binary build 638 provided by ActiveState Corp. http://www.ActiveState.com D:\Development>perl5.8.5 -le "print (%x = (qw(a 1 b 2 c 3)));" D:\Development>e:\perl5.8.5\bin\perl -le "print (%x = (qw(a 1 b 2 c 3)));" D:\Development>perl5.8.5 -v This is perl, v5.8.5 built for cygwin-thread-multi-64int Copyright 1987-2004, Larry Wall Perl may be copied only under the terms of either the Artistic License or Complete documentation for Perl, including FAQ lists, should be found on D:\Development\rating\csb_sp>e:\perl5.8.5\bin\perl -v This is perl, v5.8.5 built for MSWin32-x86-multi-thread Copyright 1987-2004, Larry Wall Perl may be copied only under the terms of either the Artistic License or Complete documentation for Perl, including FAQ lists, should be found on |
From @demerphq
Er, I meant AS 638. Sorry. Also it looks like AS 638 gets it more right but not correct than later D:\Development>perl5.6.1 -MData::Dumper -le "%h = (1 => 2, a=>'b', c => 2); D:\Development>perl5.8.5 -MData::Dumper -le "%h = (1 => 2, a=>'b', c => 2); |
From rick@bort.caOn Wed, Oct 06, 2004 at 06:58:58PM +0100, Graham Barr wrote:
It looks like it's trying to treat arrays and hashes differently to me, /* Removes from the stack the entries which ended up as Maybe that fix just didn't have enough test cases. As for what it Similarly, a list assignment in list context produces the So I think Boris's code should do what he expected. -- |
From rick@bort.caOn Wed, Oct 06, 2004 at 07:00:59PM +0100, Orton, Yves wrote:
The required trigger is a duplicate key which you don't have in your -- |
From @demerphq
Whoops. So I didn't sorry for the noise (I got the same results as you once Yves |
From @gbarrOn 6 Oct 2004, at 19:11, Rick Delaney wrote:
Yes, you are right. I was looking at old source. But the code seems flawed. It counts duplicates during the assignment Graham. |
From @davidnicolhere's the arguably obvious workaround, since the bug applies to the $ perl -MData::Dumper -le '%h = (1 => 2, a=>"b", c => 2); %x = reverse %h; %h =
-- |
@iabyn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#31865 (status was 'resolved')
Searchable as RT31865$
The text was updated successfully, but these errors were encountered: