Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: easiest way to print the content of a hash?

by McDarren (Abbot)
on Jul 13, 2006 at 15:48 UTC ( #560988=note: print w/replies, xml ) Need Help??


in reply to Re: easiest way to print the content of a hash?
in thread easiest way to print the content of a hash?

I can never quite get why nobody (apart from me) ever seems to recommend Data::Dumper::Simple for debugging?

It's way easier to use than Data::Dumper, especially for more complex data structures. There is no need to pass references, and the output contains the actual variable names - instead of "VAR1", "VAR2", etc.
I know you can get the same thing with Data::Dumper using Dumper->Dump, but this can very quickly become quite unwieldy.

About the only objection I could imagine to using Data::Dumper::Simple is that is uses source filters, but if you're only using it for debugging - and not in production code - what's the problem?

Just curious....
Darren :)

  • Comment on Re^2: easiest way to print the content of a hash?

Replies are listed 'Best First'.
Re^3: easiest way to print the content of a hash?
by japhy (Canon) on Jul 13, 2006 at 18:22 UTC
    Perhaps because it's a source filter? (Yes, I read your post. And yes, that's my reason.)

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
Re^3: easiest way to print the content of a hash?
by tinita (Parson) on Jul 13, 2006 at 20:39 UTC
    There is no need to pass references, and the output contains the actual variable names - instead of "VAR1", "VAR2", etc.
    it's time again to quote my .vimrc:
    :imap dumper <ESC>^iwarn Data::Dumper->Dump([\<ESC>llyw$a], ['<ESC>pa']);<ESC>
    let's you type '@myarraydumper' and you'll get
    warn Data::Dumper->Dump([\@myarray], ['myarray']);

    Data::Dumper is in the core, and with the help of my editor i don't have to type much to get a decent debugging output.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (1)
As of 2022-07-07 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?