in reply to HTML::TreeBuilder documentation tests trouble
To parse HTML I usually use HTML::TokeParser instead of HTML::TreeBuilder. The latter seems to me too overkill for most problems. This is probably how you can do the parsing with HTML::TokeParser:
use HTML::TokeParser; my $p = HTML::TokeParser->new("index.html") || die "Can't open: $!"; while (my $token = $p->get_token) { if ($token->[0] eq 'td') { my $txt = $p->get_trimmed_text; if ($txt eq "the text before what you're looking for") { $token = $p->get_token("td"); my $txt = $p->get_trimmed_text; # $txt will be the text you're looking for } } }
|
|---|