in reply to Data::Dumper and eval
That way, %somehash is empty and you'll avoid those errors if there's nothing in the file.open DATA, "<$datafile" or die "$!"; my $dumped_hash; { local $/; $dumped_hash = <DATA>; } my %somehash; %somehash = %{ eval $dumped_hash } if $dumped_hash;
Update: jcwren pointed out that I had an extra line that should have been edited out. I dare you to find it now.
|
---|