Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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).

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985228]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (14)
As of 2017-07-26 14:53 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (396 votes). Check out past polls.