Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi all...

Is there a way to get Data::Dumper output back into it's origanal structure, much like Storable except I don't want to save the result to file, but into a MySQL database...

Thanks

Replies are listed 'Best First'.
Re: Data::Dumper / Storable help
by marto (Cardinal) on Feb 08, 2006 at 09:47 UTC
      This is perfect... Thank you very much...
Re: Data::Dumper / Storable help
by borisz (Canon) on Feb 08, 2006 at 09:46 UTC
    You can use eval to rebuild the data. A better way to store the data is to use freeze and thaw.
    use Storable qw/freeze thaw/; use MIME::Base64 qw/encode_base64 decode_base64/; my $data_ref = { a => 'xx', b => 42 }; my $encoded = encode_base64( freeze($data_ref) ); # store $encoded in a database # restore data $data_ref = thaw( decode_base64($encoded) );
    Boris
Re: Data::Dumper / Storable help
by planetscape (Chancellor) on Feb 09, 2006 at 03:40 UTC