[Ilugc] Printing Perl data structures
- From: vkslist@xxxxxxxxx (VK Sameer)
- Date: Mon, 5 Dec 2011 10:58:39 +0000 (UTC)
Hi Girish, et al.
This has been an interesting and opinionated introduction to Perl. Thanks!
A note about a module that has helped me a lot to debug my Perl data structures
from the very beginning - Data::Dumper
From perlmonks.org (http://www.perlmonks.org/?node_id=31714):
Item Description: takes a variable ( or reference to a variable) and 'unrolls'
or dumps it out for inspection
Review Synopsis: invaluable for object design and debugging complicated data
structure
Coming from a Perl Monk, that is high praise indeed.
Its usage is very straightforward:
use Data::Dumper;
local $Data::Dumper::Indent = 1;
print "DEBUG: Your-variable: ", Dumper (\<your-variable-here);
It is an idiom in most of my Perl scripts.
Interesting side-note: its author, Gurusamy Sarathy, is probably the only Indian
who has been a Perl Pumpking, aka release manager. Link to an old (2000)
interview:
http://www.pinjax.com/gsar.html.
Regards,
Sameer
Other related posts:
- » [Ilugc] Printing Perl data structures - VK Sameer