valavanp has asked for the wisdom of the Perl Monks concerning the following question:
While using hashes of hashes, i am getting only the reference value instead of hash values. Can anyone tell me where i am wrong in the below code. Thanks Monks for your reply.
The output is%people=( 'Jones'=>{'name'=>'Alison', 'age'=>15, 'pet'=>'dog',}, 'Smith'=>{'name'=>'Tom', 'age'=>34, 'pet'=>'cat',}); foreach $key(keys %people) { print "Key is $key", "value is %{$people{$key}}"; }
Key is smith value is #{HASH(0x2251d0)} Key is Jones value is %{HASH(0 +x2250c8)}
20060715 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hashes of hashes
by sara2005 (Scribe) on Jul 15, 2006 at 12:47 UTC | |
|
Re: hashes of hashes
by Tux (Canon) on Jul 15, 2006 at 12:53 UTC | |
|
Re: hashes of hashes
by liverpole (Monsignor) on Jul 15, 2006 at 13:55 UTC | |
|
Re: hashes of hashes
by davido (Cardinal) on Jul 15, 2006 at 16:11 UTC | |
|
Re: hashes of hashes
by GrandFather (Saint) on Jul 15, 2006 at 18:45 UTC | |
|
Re: hashes of hashes
by planetscape (Chancellor) on Jul 16, 2006 at 07:33 UTC |