Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
go ahead... be a heretic

Comment on

eval() is needed only when you want a deep copy.
use Data::Dump qw( pp dd ); my $ref = [ 'foo', 'bar', { asd => 1, qwe => 2 } ]; # pp() called in void context prints to STDERR pp $ref; # prints: ["foo", "bar", { asd => 1, qwe => 2 }] # dd() called in void context prints to STDOUT dd $ref; # named printing is still not DRY, but much better than: # print Data::Dumper->Dump( [$ref], ['*ref'] ); print '$ref = ', pp($ref), "\n"; # prints: $ref = ["foo", "bar", { asd => 1, qwe => 2 }] # eval() for a deep copy my $deep_copy = eval pp($ref); pp $deep_copy;
The printing format is a lot more readable than Data::Dumper's default. However beware that Data::Dump is not among the core modules.

In reply to Re^3: Dumping variables but DRY and simple by rubasov
in thread Dumping variables but DRY and simple by LanX

and:  <code> code here </code>

  • Please read these before you post! —
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (12)
    As of 2014-03-14 14:24 GMT
    Find Nodes?
      Voting Booth?

      Have you used a cryptocurrency?

      Results (306 votes), past polls