> -----Original Message-----
> From: mark crowe (JIC) [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, July 30, 2001 11:25 AM
> To: beginners
> Subject: eval and Data::Dumper
> 
> 
> Please can someone give me some advice about Data::Dumper. I 
> have a program which will generate a large multidimensional 
> array which I then want to import into another program. From 
> what I remember from some posts a while ago (and can't find 
> again now) I should be able to do this using Data::Dumper, 
> and the Camel book and perldoc seem to agree. It's just I 
> can't work out how to read the data back in. I've tried eval 
> and do, and neither of them are working as I hoped. Here's 
> some test code I've tried:
> 
>   use Data::Dumper;
>   @array = qw(one two three);
>   $string  = Dumper(@array);
>   @newarray = eval $string;
>   print "@newarray";
> 
> This outputs:
>   $VAR1 = 'one';
>   $VAR2 = 'two';
>   $VAR3 = 'three';
>   three
> 
> I can print the Dumper output to a file and read it back in 
> with do or eval and get the same problem, just getting the 
> last value put into the array. Can someone point me in the 
> right direction please?

Suggestions:

1. Pass reference to your array to Dumper(): 

   $string = Dumper(\@array);

2. Read Data::Dumper docs and look at "Purity" and "Deepcopy" options. 

3. Look at Storable module.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to