Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Regarding Initialization and Use of Hashes

by MidLifeXis (Prior)
on Sep 04, 2012 at 17:06 UTC ( #991657=note: print w/ replies, xml ) Need Help??


in reply to Regarding Initialization and Use of Hashes

%address->{Name} should be $address{Name} in your second example.

Your first example creates a hash reference, the second creates a hash. $address is about equal to \%address.

--MidLifeXis


Comment on Re: Regarding Initialization and Use of Hashes
Select or Download Code
Re^2: Regarding Initialization and Use of Hashes
by Zaemz (Initiate) on Sep 04, 2012 at 17:07 UTC
    Ahh, alrighty. That's what I was thinking. I just needed someone to solidify it for me.
Re^2: Regarding Initialization and Use of Hashes
by Anonymous Monk on Sep 04, 2012 at 17:51 UTC
    Specifically, the braces around the hash contents in the first assignment return a hash reference. The parentheses in the second assignment give the context of a list, which will be interpreted as key-value pairs when assigned to a hash.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-11-27 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (181 votes), past polls