in reply to Get HTML::TokeParser::Simple to interpret some tags as text

Untested:
my %allowed = ( u => 1, i => 1, b => 1); my $text = ""; while ( my $token = $p->get_token ) { if($token->is_text) { $text .= $token->as_is; } elsif($token->is_tag && $allowed{$token->get_tag}) { $text .= $token->as_is; } }
Now you can filter your text in $text, for example like:
my @match = grep /$lookup/, split /\n/, $text; print "$_\n" foreach @match;
There is, of course, the chance that you'll match on the tags now.

Replies are listed 'Best First'.
Re^2: Get HTML::TokeParser::Simple to interpret some tags as text
by jonnyfolk (Vicar) on May 23, 2006 at 09:08 UTC
    OK, I get the idea now. Thanks bart - much appreciated.