pnelson has asked for the wisdom of the Perl Monks concerning the following question:
Thanks!#!/usr/bin/perl -w use diagnostics; use strict; use HTML::TokeParser; my $filename = '/Users/peternelson/Desktop/atdstudy.html'; my $stream = HTML::TokeParser->new($filename) || die "Couldn't read HTML file $filename: $!"; while (my $token = $stream->get_token) { LOOK: { if ($token->[0] eq 'C' and $token->[1] eq '<!-- InstanceBeginEdita +ble name="article" -->') { goto PARSE; } else { next; } }#end look PARSE: { if ($token->[0] eq 'C' and $token->[1] eq '<!-- InstanceEnd -->') +{ exit; } elsif ($token->[0] eq 'T') { print $token->[1]; } next PARSE; }#end parse }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extracting HTML between comments
by Aristotle (Chancellor) on Sep 01, 2004 at 19:45 UTC | |
|
Re: Extracting HTML between comments
by Eimi Metamorphoumai (Deacon) on Sep 01, 2004 at 19:49 UTC |