in reply to Re: Re: Storable with hash of hashes (reference problem?)
in thread Storable with hash of hashes (reference problem?)

Your problem is almost fixed, except that you called the second printit() before you assigned $reports to the new hash table. So your second printit() is still printing the old hash table.

Change your code to:
# save the file $reports = \%reports ; printit();
And you will print your second hash table correctly.

If $reports{$year} and $reports->{$year} are different variables, and $reports->{$year} is a hash reference, then what is $reports{$year}?

This is because $reports is a reference that points to the %reports hash table. The %reports hash table gets created after your first printit(). In your original code, in your first printit(), you tried to refer to the loaded $reports to get your year values, and then refer to undefined %reports with $reports{$year}, which has not yet been initialized. Because you haven't used strict at the beginning of your code, Perl happily created the undefined variable for you.

Cheers. Roger.