# this works
use Data:

umper; $Data:

umper:

urity=1;
my $dmp;
my %hash1 = ('k1'=>'v1','k2'=>'v2');
$dmp = Data:

umper:

umper( \%hash1 );;
my $hash2 = eval $dmp; print Data:

umper:

umper($hash2);
# this is not
use strict; use warnings;
use Data:

umper; $Data:

umper:

urity=1;
my $dmp;
my %hash1 = ('k1'=>'v1','k2'=>'v2');
$dmp = Data:

umper:

umper( \%hash1 );;
my $hash2 = eval $dmp; print Data:

umper:

umper($hash2);
what I am doing wrong
Dear George,
By now you've figured out that the $VAR1 variable in the Data:

umper:

umper() output is conflicting with "use strict;", and that setting $Data:

umper::Terse to 1 removes that conflict.
However, I question why you're dumping the output to Dumper into a string and then eval()ing it to assign to another hash. Is it because you want a convenient way to create a deep copy of a hash/array/object?
If so, I recommend using the Storable module instead. It's a standard module in Perl these days. It avoids the use of having to use eval(), and it's probably considerably quicker than doing the same thing with Data:

umper.
Here I'm giving you three different ways to use the Storable module, oneof which should nicely match what you're trying to do:
{
# Making a copy from a temporary string (using freeze() and thaw()):
use strict;
use warnings;
my %hash1 = ('k1' => 'v1', 'k2' => 'v2');
use Storable;
my $tempString = Storable::freeze( \%hash1 );
my %hash2 = %{ Storable::thaw($tempString) };
use Data:

umper; print Data:

umper:

umper( \%hash2 );
}
{
# Making a copy from a file (using nstore() and retrieve()):
use strict;
use warnings;
my %hash1 = ('k1' => 'v1', 'k2' => 'v2');
my $fileName = "file.tmp";
use Storable;
Storable::nstore( \%hash1, $fileName );
my %hash2 = %{ Storable::retrieve($fileName) };
use Data:

umper; print Data:

umper:

umper( \%hash2 );
}
{
# Making a deep copy directly (using dclone()):
use strict;
use warnings;
my %hash1 = ('k1' => 'v1', 'k2' => 'v2');
use Storable;
my %hash2 = %{ Storable::dclone( \%hash1 ) };
use Data:

umper; print Data:

umper:

umper( \%hash2 );
}
If all you want to do is to perform a deep copy on a hash/array/object, I advise using the third approach I listed (the one that uses Storable::dclone()). But if you want the data to a file to retrieve later, I recommend the approach that uses nstore() and retrieve().
Using eval() to copy data is not always a great idea. For one thing, ifyou the data that you eval() comes from a file, someone could have easily tampered with the contents of the file, placing malicious Perl code in the file that ends up getting executed when you eval() it.
So if all you want is to store data to a file (for later retrieval), useStorable::nstore() (and retrieve it later with Storable::retrieve()) instead of Data:

umper. Or if all you want is to create a deep copy/clone of an object, use Storable::dclone().
The main reason you'd want to use Data:

umper is to visually inspect the data you're working with, which is something you can't do easily with theStorable module (which is why I'm using Data:

umper in all three of my examples above). (But if you only really needed to visually inspect the data, there'd be no reason to eval() it later.)
So my advice is to use the Storable module instead of Data:

umper, unless you need to manually inspect the contents of a scalar/array/hash/object.
I hope this is helpful, George.
-- Jean-Luc