in reply to Re: Re: Hash of Arrays of Hashes Parsing
in thread Hash of Arrays of Hashes Parsing

Your solution looks fine, but I have to comment on one thing - the naming of your variables. This is just personal preference, but IMHO it makes your code much clearer and much more readable if you name the variables - especially references - what they are, or what they contain.

Here is your example with some of the variables renamed:
print "\t<tr>\n"; if (ref($data) eq 'ARRAY') { ### Since each element of the array is a hash reference, ### name it so you know what it is. #foreach my $array (@$data) foreach my $hashref (@$data) { #foreach my $value (keys %$array) foreach my($key,$value) (each %$hashref) { #print "\t\t<td>$array->{$value}</td>\n"; print "\t\t<td>$value</td>\n"; } } } elsif ref($data) eq 'HASH') { #foreach my $value (keys %$data) foreach my($key,$value) (each %$data) { #print "\t\t<td>$array->{$value}</td>\n"; print "\t\t<td>$value</td>\n"; } } else { print "\t\t<td>Too Bad Sucka!</td>\n"; } print "\t</tr>\n";