As a "i just now made this up rule of thumb", use braces when parens won't do. Parens are just a fragile container for lists, they will flatten by default:
is really just a single list. You have to use braces:my @one_d = ( (1,2,3), (4,5,6), (7,8,9) );
I prefer to use a reference to an anonymous array for the outside container, maily because there is no mixing of parens and braces, square or curly:my @two_d = ( [1,2,3], [4,5,6], [7,8,9] );
When in doubt, always consult Data::Dumper. Always! If you had used Data::Dumper on your data structure, you would have seen that the problem was within it:my $two_d = [ [1,2,3], [4,5,6], [7,8,9] ];
Finally, print out a copy of References quick reference. And don't forget about Data::Dumper! :)print Dumper \@AoH; __END__ (it's an AoHoH ... not an AoHoAoH) $VAR1 = [ { 'page' => { 'paragraph' => 'lesson1' }, 'chapter' => 'Basic', 'HASH(0x8638dec)' => undef }, { 'HASH(0x86fee04)' => undef, 'page' => { 'paragraph' => 'lesson3' }, 'chapter' => 'Advanced' } ];
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re^3: Accessing an AoHoAoH
by jeffa
in thread Accessing an AoHoAoH
by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |