SPUG: In over my head with hashes of arrays of arrays

Yitzchak Scott-Thoennes sthoenna at efn.org
Sun Jul 24 02:01:00 PDT 2005


On Fri, Jul 22, 2005 at 04:45:01PM -0700, Adam Monsen wrote:
> Good advice by all. Also, check out Data::Dumper, an invaluable tool
> at examining data structures of any kind.
> 
> use Data::Dumper;
> $myhash{evens} = [ [0,2,4], [4,6,8] ];
> print Dumper(\%myhash); # notice the backslash!
> 
> prints out:
> 
> $VAR1 = {
>          'evens' => [
>                       [
>                         0,
>                         2,
>                         4
>                       ],
>                       [
>                         4,
>                         6,
>                         8
>                       ]
>                     ]
>        };
> 
> There's also a cool replacement to Data::Dumper that prints out the
> actual variable name instead of just $VAR1, but I forget what the name
> of that module is. I suppose you can also use Data::Dumper->Dump(),
> but this module that I can't remember the name of does everything for
> you.

That would be Data::Dumper::Simple, I think.  Note that it doesn't do
anything Data::Dumper can't; in fact it's just a source filter that
comes up with the proper Data::Dumper invocation for you.

Also note that source filters don't always work and IMO are best avoided.



More information about the spug-list mailing list