Perl Language Debug Output Dumping data-structures


use Data::Dumper;

my $data_structure = { foo => 'bar' };
print Dumper $data_structure;

Using Data::Dumper is an easy way to look at data structures or variable content at run time. It ships with Perl and you can load it easily. The Dumper function returns the data structure serialized in a way that looks like Perl code.

$VAR1 = {
        'foo' => 'bar',

That makes it very useful to quickly look at some values in your code. It's one of the most handy tools you have in your arsenal. Read the full documentation on metacpan.