Maybe you can use one of the B:: modules. I have only used them a couple of times, but it seems like they do the reflection that you are looking for. You end up in the internals because that's where the structure is.
in reply to Efficient partial deep cloning
my $struct =
foo => 3
bar => 'baz'
my $node = B::XPath->fetch_root( \&some_function );
my $node= shift;
my $indent= shift;
foreach my $child ($node->get_children())
print " " for (0..$indent);
It should work perfectly the first time! - toma