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!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|