borisz has asked for the wisdom of the Perl Monks concerning the following question:
and wonder why I get three values back 'w22' I expect 'q2' or 'w2' at perls option. More testing shows even more wired results. In the example below, I expect %x reversed in %h but it is not. There was not even a 'a' => 2 pair in the original %h.perl -e '%h = ( q => 2, w => 2 ); print reverse %h = reverse %h'
Perl 5.8.4 cofuses me even moreperl -MData::Dumper -le '%h = (1 => 2, a=>"b", c => 2); %h = reverse ( + %x = reverse %h); print Dumper({x => \%x, h =>\%h});' __OUTPUT__ $VAR1 = { 'x' => { 'b' => 'a', '2' => 'c' }, 'h' => { 'a' => 2, 'c' => 2 } };
can you explain this behavior please?perl5.8.4 -MData::Dumper -le '%h = (1 => 2, a=>"b", c => 2); %h = reve +rse ( %x = reverse %h); print Dumper({x => \%x, h =>\%h});' __OUTPUT__ $VAR1 = { 'x' => { 'b' => 'a', '2' => 'c' }, 'h' => { '' => 2 } };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: whats wrong reverse %x = reverse %h?
by blokhead (Monsignor) on Sep 28, 2004 at 16:52 UTC | |
|
Re: whats wrong reverse %x = reverse %h?
by waswas-fng (Curate) on Sep 28, 2004 at 16:48 UTC | |
by borisz (Canon) on Sep 28, 2004 at 16:51 UTC | |
|
Re: whats wrong reverse %x = reverse %h?
by Zaxo (Archbishop) on Sep 28, 2004 at 16:40 UTC | |
by borisz (Canon) on Sep 28, 2004 at 16:47 UTC | |
|
Re: whats wrong reverse %x = reverse %h?
by melora (Scribe) on Sep 28, 2004 at 21:19 UTC | |
|
Re: whats wrong reverse %x = reverse %h?
by jZed (Prior) on Sep 28, 2004 at 16:44 UTC | |
by hardburn (Abbot) on Sep 28, 2004 at 16:47 UTC | |
|
Re: whats wrong reverse %x = reverse %h?
by Keystroke (Scribe) on Sep 29, 2004 at 14:55 UTC |