my $html = join '', @webpage_lines; my $p = HTML::TokeParser::Simple->new( \$html ); while ( my $token = $p->get_token ) { # This prints all text in an HTML doc (i.e., it strips the HTML) next if ! $token->is_text; print $token->return_text; }