http://qs1969.pair.com?node_id=1164279


in reply to Re^2: hash question
in thread hash question

You are missing one slight catch. When you do

my $hash = shift;
you get pointer to the object passed to the function. When you do
$hash = {a => "alpha"};
you create new object and store its pointer in the variable that previously contained pointer to another object. Finally, when you do
%{ $hash } = ( a => 'alpha', b => 'beta' );
then you take object pointed by the variable and store in that object new set of keys.

You have to distinguish "objects" and "pointers to objects", the latter are called "references" in perl, then things may become more consistent for you.