mpettis has asked for the wisdom of the Perl Monks concerning the following question:
Is there a similar way of doing this that allows me to assign an inner hash to a local reference and operate on the reference to modify the original hash?use Data::Dumper; my %a; $a{'WI'}{'GreenBay'}{'Color'} = 'Black'; foreach my $update ("WI,GreenBay,White") { my ($state,$city,$color) = split /,/, $updtate; my $h = \$a{$state}{$city}; $h->{'Color'} = $color; }; print Dumper(\%a), "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reference/Alias inner hash section
by broomduster (Priest) on Sep 08, 2008 at 23:46 UTC | |
|
Re: Reference/Alias inner hash section
by ikegami (Patriarch) on Sep 08, 2008 at 23:56 UTC | |
by mpettis (Beadle) on Sep 09, 2008 at 00:21 UTC | |
by ikegami (Patriarch) on Sep 09, 2008 at 00:28 UTC | |
by mpettis (Beadle) on Sep 09, 2008 at 00:39 UTC |