Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Data::Dumper(::Simple) is your friend

by Nkuvu (Priest)
on Jul 05, 2005 at 03:25 UTC ( [id://472344]=note: print w/replies, xml ) Need Help??


in reply to Data::Dumper(::Simple) is your friend

For simple data types, like an array or a hash, it's just as easy to print out the values yourself (with delimiters).

But Data::Dumper really shines when you have a hash-of-hashes-of-arrays-of... you get the idea. If you have a hash of hashes, you could use the code

for my $first_key (sort keys %hashiness) { print "$first_key =>\n"; for my $second_key (sort keys %{$hashiness{$first_key}}) { print "\t$second_key\n"; } }

or you could just do

print Dumper(%hashiness);

It gets comparatively easier to use Data::Dumper rather than your own print statements as your data types increase in complexity.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-16 12:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found