in reply to Converting HoA into AoH
Hopefully you understand what that data structure means. It means that, at the top level, you are creating a hash ref with two pairs of elements, each with a hash ref as a key. My guess is that you are probably looking for:
[ { flinstones => "fred", jetsons => "george" }, { flinstones => "fred", jetsons => "jane" }, { flinstones => "barney", jetsons => "george" }, { flinstones => "barney", jetsons => "jane" }, ];
With your data strcture, try this code:
use Data::Dumper; use strict; use warnings; my $blah = { { flinstones => "fred", jetsons => "george" }, { flinstones => "fred", jetsons => "jane" }, { flinstones => "barney", jetsons => "george" }, { flinstones => "barney", jetsons => "jane" }, }; print Dumper($blah);
Which prints:
$VAR1 = { 'HASH(0x224ef8)' => { 'flinstones' => 'fred', 'jetsons' => 'jane' }, 'HASH(0x1876560)' => { 'flinstones' => 'barney', 'jetsons' => 'jane' } };
|
---|
In Section
Seekers of Perl Wisdom