#!/usr/bin/perl -w use diagnostics; use strict; use HTML::TokeParser::Simple; my $filename = '/Users/peternelson/Desktop/atdstudy.html'; my $stream = HTML::TokeParser::Simple->new( $filename ) || die "Couldn't read HTML file $filename: $!"; while ( my $token = $stream->get_token ) { LOOK: { if ( $token->is_comment and $token->as_is eq '' ) { goto PARSE; } else { next; } } PARSE: { if ( $token->is_comment and $token->as_is eq '' ) { exit; } elsif ( $token->is_text ) { print $token->as_is; } next PARSE; } } #### while ( my $token = $stream->get_token ) { if( ( $token->is_comment and $token->as_is eq '' ) .. ( $token->is_comment and $token->as_is eq '' ) ) { print $token->as_is if $token->is_text; } }