Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi all.
I'm trying to read in a hash reference dumped to a file with Data::Dumper via an eval with no success. After much frustration I've discovered this works fine in the debugger, but not in the code. I was hoping someone could explain why.
I know there are better ways to do this (Storable, etc.) but I need a plain text version of the data and, more importantly, I'd like to know why this happens differently in the debugger.
However, when using the debugger:#perl v5.10.1 my $testdata; open(DATA, "<filename") or die $!; { local $/; $DB::single=1; $testdata = eval <DATA>; } close DATA; #testdata will be undefined
Thanks for your time.DB<2> $testdata = eval <DATA>; DB<3> x $testdata #outputs the expected data
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading in a dumped hash reference works in the perl debugger but not in the code.
by LanX (Saint) on Mar 15, 2012 at 16:44 UTC | |
by Anonymous Monk on Mar 15, 2012 at 17:00 UTC | |
|
Re: Reading in a dumped hash reference works in the perl debugger but not in the code.
by Ken Slater (Initiate) on Mar 15, 2012 at 17:06 UTC | |
by Anonymous Monk on Mar 15, 2012 at 18:00 UTC |