I had myself problems with it recently. As long as you storing scalars, it work perfectly as coded in the examples above. When it comes to references, your fears become true.
You sound a little confused. You can only ever store scalars in a hash. A reference is just a special kind of scalar. You can never overwrite an entire hash by assigning to one of its values.
my %my_hash; sub my_store($\%){ my($key,$ref) = @_; $my_hash{$key} = {%$ref} }
I'd guess it's almost certainly the unnecessary use of prototypes that is confusing you there :)
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re^3: How to build a hash?
by davorg
in thread How to build a hash?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |