this may make it a little clearer
The point about the quotes is that double quotes interpolate variable into their contents before passing them on. Single quotes don't.#!d:\perl\perl my %hash; my %direc; my $record = { DIR => 3 }; $hash{'myhash'} = $record; print $hash{'myhash'},"\n"; ## Prints HASH(0x1b9f0b8) print $hash{'myhash'}{DIR},"\n"; ## Prints 3 $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'}{DIR} = \%direc; print $hash{'myhash'}->{DIR}{'this'},"\n"; ## Prints something print $hash{'myhash'}{DIR}{'this'},"\n"; ## Prints something print $hash{'myhash'}->{DIR}{'that'},"\n"; ## Prints another print $hash{'myhash'},"\n"; ## Prints HASH(0x1b9f0b8) print $hash{'myhash'}{DIR},"\n"; ## Prints HASH(0x1b95778)
In reply to Re: Referencing to a hash inside a hash of hashes.
by astaines
in thread Referencing to a hash inside a hash of hashes.
by JPaul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |