in reply to Removing selective tags and content between
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Removing selective tags and content between
by diamich (Initiate) on Oct 15, 2003 at 14:33 UTC | |
by Ovid (Cardinal) on Oct 15, 2003 at 16:07 UTC |