in reply to Re: Merging two anchors with HTML::TreeBuilder
in thread Merging two anchors with HTML::TreeBuilder

HTML::TreeBuilder::XPath with htmltreexpather.pl makes it easier to find what you want, like the second link in each tablecell
use HTML::TreeBuilder::XPath; #~ my $root = HTML::TreeBuilder->new; my $root = HTML::TreeBuilder::XPath->new; for my $secondlink ( $root->findnodes( '//td/a[2]' ) ){ my $td = $secondlink->parent; my $newtext = $td->as_trimmed_text ; $secondlink->delete_content; $secondlink->push_content( $newtext ) ; $secondlink->detach; $td->delete_content; $td->push_content( $secondlink ); }

Replies are listed 'Best First'.
Re^3: Merging two anchors with HTML::TreeBuilder
by mldvx4 (Hermit) on May 10, 2016 at 19:29 UTC

    Thanks, both. I've gone with the HTML::TreeBuilder::XPath option.