Thursday, December 30, 2010

Data Dumper


use Data::Dumper;
my $hashref= {a => 1, b => 2};
print Dumper($hashref);


use Data::Dumper;
my %hashvar = (a => 1, b => 2);
print Dumper(\%hashvar);

In the first case the variable is a hash so you must take its reference; in the second you have a reference to a hash and is therefore passed as-is to Data::Dumper

http://stackoverflow.com/questions/4562574/how-do-i-do-something-like-print-dumper-var-in-empedperl

No comments: