sub hash_to_html {
my $x = shift;
return "" unless ref($x) eq "HASH";
return "
".join("", map { "- $_\n".hash_to_html($x->{$_}) } sort keys %$x )."
\n";
}
$our_hash = {
'Cows' => {
'Brown' => undef,
'Green' => undef,
'Strawberry' => {
'Spotted' => undef,
'Solid' => undef
},
'Orange' => undef
},
'Dogs' => {
'Purple' => {
'Spotted' => undef,
'Solid' => undef
}
}
};
print hash_to_html($our_hash);