in reply to Parsing with HTML::Parser

I am a little surprised that no one has suggested this before me.
use LWP::Simple qw($ua get head); use HTML::TokeParser::Simple; my $webpage = "http://some-url.com"; $ua->timeout(30); my ($html, $parsed_html); if (head($webpage)) { $html = get $webpage || return 0; } else { return 0; } my $p = HTML::TokeParser::Simple->new( \$html ); while ( my $token = $p->get_token ) { next unless $token->is_text; $parsed_html .= $token->as_is; }
update: Woops, guess I did not read the first post completely. I posted nearly the same code.