Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Hash reference Problem

by glide (Pilgrim)
on Dec 27, 2007 at 15:03 UTC ( #659210=note: print w/replies, xml ) Need Help??


in reply to Hash reference Problem

This output
'2' => { 'test1' => { '1' => $VAR1->{'1'}{'test1'},
it's just a more compact way of showing the structure

try this

use Data::Dumper; # VERSION 1 my $ref_1; $ref_1->{'1'}->{'test1'}->{'key1'} = '1'; $ref_1->{'1'}->{'test1'}->{'key2'} = '2'; $ref_1->{'1'}->{'test1'}->{'key3'} = '3'; $ref_1->{'1'}->{'test2'}->{'key1'} = '4'; $ref_1->{'1'}->{'test2'}->{'key2'} = '5'; $ref_1->{'1'}->{'test2'}->{'key3'} = '6'; $ref_1->{'2'}->{'test1'}->{'key1'} = '1'; $ref_1->{'2'}->{'test1'}->{'key2'} = '2'; $ref_1->{'2'}->{'test1'}->{'key3'} = '3'; $ref_1->{'2'}->{'test2'}->{'key1'} = '4'; $ref_1->{'2'}->{'test2'}->{'key2'} = '5'; $ref_1->{'2'}->{'test2'}->{'key3'} = '6'; foreach my $b1 (keys %{$ref_1->{'1'}}) { if(exists $ref_1->{'2'}->{$b1}) { $ref_1->{'2'}->{$b1}->{'1'} = $ref_1->{'1'}->{$b1}; } } $Data::Dumper::Deepcopy=1; print Dumper $ref_1;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://659210]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2018-07-20 20:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (441 votes). Check out past polls.

    Notices?