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

I haven't used Storable before so I'll offer this instead. Try using Data::Dumper. It is very simple and I've never had any trouble with it. A simple example:
#!/usr/bin/perl use strict; use warnings; use diagnostics; use Data::Dumper; my @array; my %hash; #save the array open (FILE,">array.dat"); print FILE Data::Dumper->Dump([\@array],['*array']); close (FILE); #save the hash open (FILE,">hash.dat"); print FILE Data::Dumper->Dump([\%hash],['*hash']); close (FILE); # read in the array open (FILE,"array.dat"); undef $/; eval <FILE>; close(FILE); # read in the hash open (FILE,"array.dat"); undef $/; eval <FILE>; close(FILE); exit;
Of course the array and hash are empty but you already seem to understand how to fill them and read them back.

Replies are listed 'Best First'.
Re: Re: Storable with hash of hashes (reference problem?)
by tilly (Archbishop) on Oct 12, 2003 at 02:59 UTC
    Storable breaks less often than Data::Dumper, and produces a much more compact representation. Sometimes that space efficiency is nice (like when you want to stuff objects in a database).