Data::Dumper
Converts Perl data structures into strings that can be
printed or used with eval to
reconstruct the original structures. Takes a list of scalars or
reference variables and writes out their contents in Perl syntax.
Several interfaces to Data::Dumper are provided:
Simple procedural interface:
print Dumper($foo, $bar);
Extended usage with names:
print Data::Dumper->Dump([$foo, $bar], [qw(foo *ary)]);
Object-oriented interface:
$d = Data::Dumper->new([$foo, $bar], [qw(foo *ary)]); ... print $d->Dump;
By default, references are identified as $VAR n, in which
n is a numeric suffix. References to
substructures within $VAR
n are labeled using arrow notation. In the
extended usage form, references can be given user-specified names. See
the Data::Dumper manpage for examples of the module’s use.
Several configuration variables can be used to control the output generated using the procedural interface. These variables control the default state of the object created by the new method. Each variable has a corresponding method that can be used later to query or modify the object. In the following list, each variable is followed by the corresponding method:
$Data::Dumper::Bless$obj->Bless([newval])Can be set to a string that specifies an alternative to the
blessbuilt-in operator used to create objects. A function with the specified name should exist and should accept the same arguments as the built-in. Default isbless.$Data::Dumper::Deepcopy$obj->Deepcopy([newval])If set to a Boolean ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access