Perl Language Debug Output Dumping data-structures

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

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.



Got any Perl Language Question?