in reply to Reading anonymous array from file
G'day sherab,
I see ++McA has provided a solution for reconstructing the data stored by (I presume) Data::Dumper.
If the creation of 'data.txt' is also under your control, you might condsider the built-in module Storable. Here's an example usage:
#!/usr/bin/env perl -l use strict; use warnings; use Storable; my $file = './data.txt'; my @original_array = ('Snow', 'White', '1313 Mockingbird Lane'); store \@original_array => $file; my @retrieved_array = @{retrieve($file)}; print for @retrieved_array;
Output:
Snow White 1313 Mockingbird Lane
-- Ken
|
|---|