edwardt_tril has asked for the wisdom of the Perl Monks concerning the following question:
use Data::Dumper; my %HoH = ( flintstones => { husband => "fred", pal => "barney", }, jetsons => { husband => "george", wife => "jane", "his boy" => "elroy", # Key quotes needed. }, simpsons => { husband => "homer", wife => "marge", kid => "bart", }, ); sub new { my $class = shift; my %self = %HoH; bless \%self, $class; } sub updatename{ my ($self, $keyname, $keysubname,$keyvalue)=@_; $self->{$keyname}{$keysubname}= {$keyvalue}; } print Dumper(%HoH); updatename("flintstones","husband","joe"); print Dumper(%HoH);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: updating hash of hash
by ikegami (Patriarch) on Mar 21, 2006 at 20:12 UTC | |
|
Re: updating hash of hash
by kwaping (Priest) on Mar 21, 2006 at 20:56 UTC |