It's worth noting that Data::Dumper (core) and Data::Dump (my favorite) and many other, similar modules are designed to produce text that is compilable code. So compiling and running the exact OPed Data::Dumper output (with strict disabled!):
will produce output that is an exact image (replica?) of the structure defined (and that is, in turn, compilable). If you like using strict (a wise choice IMHO), just pre-define the variable with our or, usually better because lexical, my. If you don't like the name, call it something else.$VAR1 = { 'key' => { 'innerkey2' => [ 'here' ], 'innerkey3' => [ 'there' ], 'innerkey1' => [ 'hello', 'world' ] } }; print Dumper $VAR1;
use warnings; use strict; use Data::Dump qw(dd); my $something_else = { ..., }; dd $something_else;
Update: For some reason, I can't get either [mod://Data::Dump] or [cpan://Data::Dump] to link to the module, but I can see it on CPAN. You'll just have to fend for yourselves. Later: [mod://Data::Dump] works now. And there was great rejoicing...
In reply to Re: Creating a hash of hashes of arrays
by AnomalousMonk
in thread Creating a hash of hashes of arrays
by estreb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |