http://www.perlmonks.org?node_id=433537

BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know of a module/function which will dump a perl data structure in a compact, human readable format that doesn't aspire to being a serialisation module?

  1. Dumps what's in the structure without attempting to analyse it.

    I don't care if the array in two or more nested arrays are references to the same array. I just want to see what's in there.

    And I have no use for a module that takes up 20 times as much memory to dump the contents of a structure than the structure itself takes up.

  2. Dumps the contents in a compact, but "structured" manner (read indented).
  3. Produces sensibly compact output that looks roughly the way I might key it in--without trying to make the output evalable.

    Keeps nested structures on one line if it is practical. Preferably with a setable wrap limit that I can set to 1000 or 2000 if I wish--not hard coded to wrap at 72!

    ie. somthing like:

    { a => [ 1, 2, 3 ], b => [ { X => 1, Y=> 2 } { X => [ 1, 2, 3], Y=> [ 4, 5, 6 ], Z => [ 7, 8, 9 ] }, c => 'fred', }

    Not YAML!

    Preferably a function rather than an object.


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.