Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Referencing to a hash inside a hash of hashes.

by astaines (Curate)
on Aug 08, 2001 at 02:35 UTC ( #102925=note: print w/ replies, xml ) Need Help??


in reply to Referencing to a hash inside a hash of hashes.

this may make it a little clearer

#!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)
The point about the quotes is that double quotes interpolate variable into their contents before passing them on. Single quotes don't.
-- Anthony Staines


Comment on Re: Referencing to a hash inside a hash of hashes.
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://102925]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2014-10-26 00:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls