I have been trying to restore output from data dumper, with absolutely no luck. I believe that i have followed the cpan documentation EXACTLY, and am getting nowhere. Here is a trivial program ive written that doesnt work as advertised:
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
{
my $hashref = {
"aaa" => 1,
"bbb" => 2,
"ccc" => 3,
};
print "hashref : " . Dumper($hashref);
my $dumped = Dumper($hashref);
print "Dumped: $dumped\n";
my $restored = eval $dumped;
print "restored: " . Dumper($restored);
my $test_2 = eval(Dumper($hashref));
print "test_2: " . Dumper($test_2);
}
And here is the output:
hashref : $VAR1 = {
'ccc' => 3,
'bbb' => 2,
'aaa' => 1
};
Dumped: $VAR1 = {
'ccc' => 3,
'bbb' => 2,
'aaa' => 1
};
restored: $VAR1 = undef;
test_2: $VAR1 = undef;
Now from all the documentation ive read, both $restored and $test_2 should contain copies of the original $hashref, but dont. Any insight would be great.
Of course it could just be that step 2 of the underpants gnomes plan was to lobotomize me!