use HTML::Parser; my $string = ""; sub search { my @terms = split(/\s+/, $FORM{'terms'}); my $parser = HTML::Parser->new( api_version => 3, start_h => [\&start,"self,tagname,attr"], text_h => [\&text,"self,dtext"], end_h => [\&end,"self,tagname"]); for my $html_file(@FILES){ $string = ''; $parser->parse_file($html_file); foreach $term (@terms) { &Umlaute; if ($string =~ /$term/) { $include{$FILE} = 'yes'; last; } else { $include{$FILE} = 'no'; } } } } sub start{ my ($self,$tag,$attr) = @_; if($tag eq 'div' && $attr->{class} eq 'scroll'){ $self->{search} = 1; } } sub text{ my ($self,$dtext) = @_; $string .= $dtext if($self->{search}); } sub end{ my ($self,$tag) = @_; if($tag eq 'div'){ $self->{search} = 0; } }