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

The only caveat I can think of with Data::Dumper is that the data is evaled. That could cause execution of evil code. However, since you are creating this data yourself, the decision to trust the data or not may require a little investigation into the general security of your box.

I am trying to figure out Storable as a result of your post. So far I have found that it appears to be much faster at storing arrays than Data::Dumper. When storing a hash, the both seem to be about the same speed. What I don't like aoubt it is Storable returns a reference to a hash or array instead of the actual data.

Oh yeah, there was a question:
If $reports{$year} and $reports->{$year} are different variables, and $reports->{$year} is a hash reference, then what is $reports{$year}?
From what little I know about it, a reference is just a scalar that points a different location. Kind of like pointers in C. $reports{year} (in relation to your original example) would be the data you created at the beggining of your script and $reports->{year} would be a reference (pointer) to the data that you read using Storable. They are two entirely different chunks of data and one can be changed without affecting the other.

Replies are listed 'Best First'.
Re: Re: Re: Re: Storable with hash of hashes (reference problem?)
by BUU (Prior) on Oct 09, 2003 at 02:30 UTC
    $reports{$year} is %reports. $reports->{year} is dereferencing a hash ref contained in a scalar. The arrow is not needed for things like $array[1][2] where $array[1] is actually an array ref.