D'oh - now I understand how you're gonna do it.
I didn't think on that possibility with 'eval <expression'> where expression
is the output of Data::Dumper.
Thank you for this really fascinating solution!

With best regards
Stefan Rusterholz, [EMAIL PROTECTED]
----------------------------------
interaktion gmbh
Stefan Rusterholz
Z�richbergstrasse 17
8032 Z�rich
----------------------------------
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
----------------------------------

----- Original Message -----
From: "Simon Oliver" <[EMAIL PROTECTED]>
To: "Stefan Rusterholz" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, October 03, 2001 11:38 AM
Subject: Re: Storing multidimensional Hashes/Arrays


> > No, I think you missunderstood me:
> Not at all, see attached script.
>
> > I also found some modules on CPAN, but unfortunately all that I found
had
> > parts written in C and I need a perl-only module (cross-plattform-able
> > without recompiling and finding all that incompatibilities).
> Which is why i suggested Data::Dumper.
>
> --
>   Simon Oliver
>
> use warnings;
> use strict;
> use Data::Dumper;
>
> my $my_hash = {
>   a => 1,
>   b => 2,
>   r1 => {
>     c => 3,
>     d => 4,
>   },
>   r2 => {
>     e => 4,
>     f => 6,
>     r3 => {
>       g => 7,
>       h => 8,
>     },
>   },
> };
>
> my $d = Data::Dumper->new([$my_hash], ['my_hash']);
> $d->Indent(0);
> $d->Purity(1);
>
> my $file = 'out.dump';
> open FH, ">$file" or die "Can't open '$file' for writing: $!\n";
> print FH $d->Dump;
> close FH;
>
> open FH, "<$file" or die "Can't open '$file' for reading: $!\n";
> my $new_hash = eval <FH>;
> close FH;
>
> print Dumper($new_hash);
> _______________________________________________
> Perl-Win32-Web mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
>
>
>

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to