#!/usr/bin/perl use warnings; use strict; use HTML::PullParser; print strip("Hello!\n"); sub strip { my $html = shift; my $parser = HTML::PullParser->new( doc => $html, text => 'text', ); my $result = ''; while(my $t = $parser->get_token) { $result .= $t->[0]; } return $result; };