shemp has asked for the wisdom of the Perl Monks concerning the following question:
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:
Of course it could just be that step 2 of the underpants gnomes plan was to lobotomize me!
And here is the output:#!/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); }
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!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Data::Dumper and eval
by perlmonkey (Hermit) on Sep 25, 2003 at 00:03 UTC | |
Re: Data::Dumper and eval
by broquaint (Abbot) on Sep 25, 2003 at 09:18 UTC | |
Re: Data::Dumper and eval
by iburrell (Chaplain) on Sep 25, 2003 at 21:24 UTC | |
Re: Data::Dumper and eval
by shemp (Deacon) on Sep 25, 2003 at 12:52 UTC |
Back to
Seekers of Perl Wisdom