in reply to dereference hash
Whenever I see code like: print $$hash_ref{$key}; I have to think hard as to whether that is equivalent to:
print ${ $hash_ref }{ $key };
Or:
print ${ $hash_ref{ $key } };
With the second form, I don't have that indecision.
In a similar vein, given this sub:
sub x{ print $$_[0][1] };;
What do you think these two calls print?:
x( [['a','b'],['c','d']] );; x( ['a','b'],['c','d'] );;
Produces:
Is it clearer if the sub is defined this way?:
sub x{ print $_[0]->[1] };; xx( [['a','b'],['c','d']] );; xx( ['a','b'],['c','d'] );;
Produces:
|
|---|