Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Dump using Dumper

by davido (Cardinal)
on Mar 23, 2004 at 05:34 UTC ( #338902=note: print w/replies, xml ) Need Help??

in reply to Dump using Dumper

You can manipulate the formatting of Data::Dumper's output. It may not be exactly the format you're wanting though, but it may be closer than the default is. The POD for that module explains how to:

  • Control the style of indentation.
  • Specify a string to be prefixed to every line of output.
  • Change the prefix of variable names in output.
  • Adjust output to a more "terse" format (maybe close to what you want).

Update: Here is an example of how close you can get with Data::Dumper:

use strict; use warnings; use Data::Dumper; my %hash = qw/this 1 that 2 those 3 them 4/; $Data::Dumper::Terse++; $Data::Dumper::Quotekeys = 0; $Data::Dumper::Indent = 1; print Dumper \%hash; __OUTPUT__ { those => '3', them => '4', that => '2', this => '1' }

Without the formatting overrides, here is what you would have gotten:

$VAR1 = { 'those' => '3', 'them' => '4', 'that' => '2', 'this' => '1' };


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://338902]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2022-01-27 06:10 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (70 votes). Check out past polls.