my @table = $root->look_down( _tag => 'table', .... ); # <== insert additional attributes to specify the proper table while ( @table ) { my $node = shift @table; if ( ref $node ) { .... # possibly do stuff depending on $node->tag and $node->attr(...) unshift @table, $node->content_list; } else { .... # here we have the leaf, or plain text } }