# Data::Dumper
π¦ std
Stringify Perl data structures into valid Perl code β feed the result back
through `eval` and you rebuild the original structure.
Two calling styles cover almost everything:
- **Functional**: `Dumper(\%h, \@a)` β one call, one string, uses the
package-global configuration variables (`$Data::Dumper::Indent` etc.).
- **Object-oriented**: `Data::Dumper->new([\%h, \@a], ['hash', 'array'])`
returns a configurable dumper object. Chain accessors to tune output,
then call `->Dump` to produce the string.
The main knobs:
- `$Indent` β `0` compact, `1` line-wrapped, `2` line-wrapped with
alignment (the default and the most readable).
- `$Purity` β when true, round-trip fidelity for self-referential and
cyclic structures at the cost of extra fixup statements.
- `$Sortkeys` β `1` for alphabetical, or a coderef returning the key
order per hash.
- `$Deepcopy` β break shared references and emit each one as a copy.
- `$Terse` β omit the `$VAR1 = ` prefix; emits a bare expression.
- `$Useqq` β quote strings with `""` and visible escapes (`\n`, `\t`,
`\x{...}`) instead of `'...'`.
- `$Sparseseen` β skip populating the internal Β«seenΒ» hash for values
that the dumper can prove are never revisited. Trades memory for
a small amount of safety on bizarre inputs.
Cycles and shared references are tracked through an internal *seen*
table keyed by referent address; a second visit prints as a backref
like `$VAR1->[0]` instead of recursing forever.
Most of the user-facing surface (`new`, `Dump`, `Reset`, `Seen`,
`Values`, `Names`, all configuration accessors, `import`) lives in
`Dumper.pm` and loads from disk; this file provides the two routines
that must be written in Rust: the heavy-lifting serializer `Dumpxs`
and the vstring magic probe `_vstring`.
## Functions
### Core API
#### [`dumpxs`](Dumper/dumpxs.md)
Serialize one or more values into valid Perl code, fast.
### Introspection
#### `vstring`
Return the raw bytes of a v-string, or `undef` if the argument is not a v-string.