You can use lynx with the -dump option to achieve this:
use File::Temp; sub html2Txt { my $html = shift; my $html_file = File::Temp->new(SUFFIX => '.html'); print $html_file $html; close $html_file; return scalar `lynx -dump $html_file 2> /dev/null`; } print html2Txt '<h1>Hi there!</h1> Testing <p>Testing</p>';
source share