Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Difference in accessing a Hash

by moritz (Cardinal)
on Aug 03, 2012 at 13:03 UTC ( #985228=note: print w/ replies, xml ) Need Help??


in reply to Difference in accessing a Hash

$a{b} accesses the hash %a, which has no relation to the variable $a. $a->{b} assumes that $a is a hash reference, and accesses the element b of it.

Always use strict, it will catch such errors if you happen to write the wrong one (and the other one isn't declared).


Comment on Re: Difference in accessing a Hash
Select or Download Code
Re^2: Difference in accessing a Hash
by perl@1983 (Sexton) on Aug 03, 2012 at 13:06 UTC
    Got it. Thanks moritz for the clarification.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2014-11-21 20:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (117 votes), past polls