use HTML::Parser; print strip("Hello!\n"); sub strip { my $html = ''; my $p = new HTML::Parser( api_version => 3, text_h => [ sub { $html .= shift }, 'text'], ); $p->parse(shift); $p->eof; return $html; }