in reply to Adding to a hash reference

You don't need this part , delete it, and it should just work

# New site $h{'siteA'} = {'09-10-2011' => 1};

Its called autovivification, it means if you use it like a hash ref it magically becomes a hashref.

See References quick reference, autovivification, perlglossary#autovivification, autovivification

Replies are listed 'Best First'.
Re^2: Adding to a hash reference
by Anonymous Monk on Dec 08, 2011 at 13:48 UTC
    That replaces what was in $h{'siteA'} to start with. It doesn't add a new entry to the hash reference.

    The first answer looks good to me.