I'm still getting acquainted with perl datastructures. I have a working structure for storing my data... but it is UGLY and BULKY. I'm sure there is a better way to do this... someone please slap me across the face and show me the error of my ways.
Note... the order in which the data is accessed is important! It is also my preference to preserve the key-value relationship between the data if at all possible.
my @fooFeatures = ( { 'Baked Goods' => [ { 'Cookies' => ['Chocolate Chip', 'Oreo'] }, ]}, { 'Fruits' => [ { 'Apples' => ['Fuji', 'Granny Smith'] }, { 'Oranges' => ['Tangerine', 'Navel'] }, ]}, ); for my $fooSet ( @fooFeatures ) { while (my ($key, $value) = each(%$fooSet)) { for my $hash ( @{$value} ) { while (my ($k, $v) = each(%$hash)) { for my $feature ( @{$v} ) { print "($k, $feature)<br>"; } } } } }
In reply to AoHoAoH... am I delusional? by jaydstein
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |