Re: [perl #31865] weird results from reverse( %x = reverse %h )

2004-10-06 Thread Rafael Garcia-Suarez
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' => { >

Re: [perl #31865] weird results from reverse( %x = reverse %h )

2004-10-06 Thread Rick Delaney
On Wed, Oct 06, 2004 at 06:50:17PM +0200, 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' => { > >

Re: [perl #31865] weird results from reverse( %x = reverse %h )

2004-10-06 Thread Graham Barr
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

RE: [perl #31865] weird results from reverse( %x = reverse %h )

2004-10-06 Thread Orton, Yves
> I dunno, but some more data points: > > $ perl5.8.3 -le 'print (%x = ("a",1,"b",2,"b",3));' > bb > $ perl5.6.1 -le 'print (%x = ("a",1,"b",2,"b",3));' > a1bb3 > > I'm not sure what it should print but those are both obviously wrong. Maybe its also OS specific? On Win32 I could

RE: [perl #31865] weird results from reverse( %x = reverse %h )

2004-10-06 Thread Orton, Yves
> Maybe its also OS specific? On Win32 I couldn't repeat this behaviour using > either AS Perl 5.6.1 (658) or under a home built Perl 5.8.5 nor under the > Cygwin Perl 5.8.5 either. Er, I meant AS 638. Sorry. Also it looks like AS 638 gets it more right but not correct than later versions: D:\De

Re: [perl #31865] weird results from reverse( %x = reverse %h )

2004-10-06 Thread Rick Delaney
On Wed, Oct 06, 2004 at 06:58:58PM +0100, Graham Barr wrote: > > 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 wo

Re: [perl #31865] weird results from reverse( %x = reverse %h )

2004-10-06 Thread Rick Delaney
On Wed, Oct 06, 2004 at 07:00:59PM +0100, Orton, Yves wrote: > > > I dunno, but some more data points: > > > > $ perl5.8.3 -le 'print (%x = ("a",1,"b",2,"b",3));' > > bb > > $ perl5.6.1 -le 'print (%x = ("a",1,"b",2,"b",3));' > > a1bb3 > > > > I'm not sure what it should print bu

RE: [perl #31865] weird results from reverse( %x = reverse %h )

2004-10-06 Thread Orton, Yves
> > D:\Development>perl -le "print (%x = (qw(a 1 b 2 c 3)));" >^ >b in my example > > a1b2c3 > > The required trigger is a duplicate key which you don't have in your > trials. Whoops. So I didn

Re: [perl #31865] weird results from reverse( %x = reverse %h )

2004-10-06 Thread Graham Barr
On 6 Oct 2004, at 19:11, Rick Delaney wrote: On Wed, Oct 06, 2004 at 06:58:58PM +0100, Graham Barr wrote: 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 bei

Re: [perl #31865] weird results from reverse( %x = reverse %h )

2004-10-08 Thread David Nicol
here's the arguably obvious workaround, since the bug applies to the list returned from assignment of a list to a hash, don't use assignment-of-an-array-to-a-hash as an rvalue. One assumes that Boris did this to get the result he wanted. $ perl -MData::Dumper -le '%h = (1 => 2, a=>"b", c => 2); %