Pass new variable name to Data::Dumper function
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
# create a complex data type
my @a = (
'hello, world',
1234.56,
[ 2, 4, 6 ],
{ one => 'first', two => 'second' }
);
# create a reference to it
my $r = \@a;
# dump it out
print Data::Dumper->Dump([$r], ['myvarname']);
Related examples in the same category