I'm using Data::Dumper
to print a perl hash with configuration, which will be evaluated by another script. The problem is that it always prints $VAR =
at the start of output. I tried settings the Varname
parameter to empty string, but then i get $1
instead of $VAR
. How do I prevent printing the variable name using Dumper
?
my $params = {-PARAMS => 0} #data
local $Data::Dumper::Purity = 1;
local $Data::Dumper::Varname = "";
print Dumper($params) ;
Prints:
$1 = {
'-UPDATE' => 0,
}
I want to have:
{
'-UPDATE' => 0,
}
Simply set $Data::Dumper::Terse = 1;
and it should work:
$ perl -MData::Dumper -wle '$Data::Dumper::Terse = 1; print Dumper {-PARAMS => 1}'
{
'-PARAMS' => 1
}