in reply to Help with better complex hash processing
You're right, a general solution would involve recursion. I don't think you need it in this case, because your tree has a specific fixed depth. But here's a recursive solution anyway:
sub tree_to_table { if ( ref $_[-1] ) { my $hr = pop; my @kv; tree_to_table( @_, @kv ) while @kv = each %$hr; } else { local($,,$\) = (',',"\n"); print map qq("$_"), @_ } } tree_to_table( $exception_report );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Help with better complex hash processing
by josephworkman (Novice) on Sep 27, 2006 at 17:22 UTC |