Try HTML::TokeParser::Simple. It will handle most of your parsing needs.
use strict; use warnings; use HTML::TokeParser::Simple; my $page = do { local $/; <DATA> }; my $parser = HTML::TokeParser::Simple->new(\$page); my $html = ''; $parser->get_tag('body'); # skip to first body tag while (my $token = $parser->get_token) { last if $token->is_end_tag('body'); $html .= $token->as_is; } print $html; __END__ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>test</title> </head> <body> <h1>headline</h1> <p>Content</p> </body> </head>
Cheers,
Ovid
New address of my CGI Course.
In reply to Re: Removing selective tags and content between
by Ovid
in thread Removing selective tags and content between
by diamich
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |