in reply to Re^2: Need Example of Saving and Retrieving Hash from File
in thread Need Example of Saving and Retrieving Hash from File
I'm aware of the situation with $VAR1, that's why I cautioned the OP to look at the contents of the file to see what perl is being asked to evaluate. That's one of the reasons why I use Storable instead of Data::Dumper; if I'm stuck with having to use D::D for some reason then I use the two-argument version of Dump so that I can control the names of the LHS variables in the dumped string, and then when I restore I rely on the dumped assignment. E.g., in the storing code:
and in the retrieving code:print $out Data::Dumper->Dump( [ \%hash ], [ '*dict' ] );
my %dict; eval $dumped_string # initializes %dict or die $@;
the lowliest monk
|
|---|