in reply to Referencing to a hash inside a hash of hashes.
my %hash; my %direc; my $record = { DIR => 3 }; $hash{'myhash'} = $record; $direc{'this'} = "something"; $direc{'that'} = "another"; #Here we swat the previous value of $hash{'myhash'} #the previous value of $hash{myhash} ($record) vanishes $hash{'myhash'}{ODIR} = \%direc; print $hash{'myhash'}->{ODIR}{'this'},"\n"; print $hash{'myhash'}{ODIR}{'this'},"\n"; print $hash{'myhash'},"\n";
In general, don't bother dereferencing with ->. It's not worth it unless you know why you want to.
Also, you don't need the '' around the key values. They'll just cause you trouble later.
____________________
Jeremy
I didn't believe in evil until I dated it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Referencing to a hash inside a hash of hashes.
by runrig (Abbot) on Aug 08, 2001 at 01:04 UTC | |
by tye (Sage) on Aug 08, 2001 at 07:25 UTC |