I have been starting to use complex datastructures. This
prints out the struct in a (sort of) readable way.
Does not deal with circular references.
sub print_hash
{
my ($temp, $spacer)=@_;
my $key;
foreach $key (keys(%$temp))
{
print "$spacer\ key=$key\tElement=". %$temp->{$key}. "
+\n";
if (%$temp->{$key} =~/ARRAY/)
{ print_array(%$temp->{$key}, $spacer." "); }
}print "\n";
}
sub print_array
{
my ($array, $spacer)=@_;
my $i;
foreach $i (@$array)
{
print "$spacer\ $i\n";
if ($i =~ /HASH/)
{ print_hash($i, $spacer." "); }
}
print "\n";
}