http://www.perlmonks.org?node_id=1001307


in reply to Read text from HTML file and display it

Another way to do it:
#!/usr/bin/perl BEGIN { $| = 1; $^W = 1; } use strict; use autodie; use warnings; use HTML::TreeBuilder; use HTML::FormatText; my $html = shift @ARGV; my $tree = HTML::TreeBuilder->new->parse_file($html); my $formatter = HTML::FormatText->format_file( $html, leftmargin => 0, rightmargin => 50, ); print $formatter;