http://www.perlmonks.org?node_id=1024676


in reply to Array of Hashes

Indeed, Data::Dumper will do. Data::Dump sometimes prints more compact results. Both output formats can be customized to suit your taste, but since this appears to be just debug print you need, the above will probably fit the bill.

You can always roll your own, too, although I'd suggest you think twice or more before you go to a lot of work.

#!/usr/bin/env perl use 5.014; use warnings; use Data::Dump; use Data::Dumper; my @hash_array = map { gen_hash() } 1..10; dd @hash_array; # Dumper(\@hash_array); # Generate a hash ref with some junk in it, two levels deep sub gen_hash { my $h; $h->{int rand 1000}->{int rand 1000} = int rand 1000 for 1..10; return $h; } __END__ Output: ( { 148 => { 570 => 799 }, 279 => { 679 => 288 }, 289 => { 2 => 464 }, 524 => { 501 => 746 }, 527 => { 122 => 839 }, 574 => { 924 => 173 }, 607 => { 295 => 240 }, 662 => { 163 => 277 }, 664 => { 157 => 606 }, 686 => { 32 => 425 }, }, { 232 => { 321 => 314 }, 358 => { 555 => 596 }, 365 => { 116 => 170 }, 579 => { 536 => 659 }, 693 => { 540 => 254 }, . . .