http://www.perlmonks.org?node_id=985228


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.