in reply to parsing html file
What you're forgetting is that the parse method of HTML::TreeBuilder (inherited from HTML::Parser) does not process a single, whole HTML document, it processes a chunk; each time you call it, it adds to the current tree. Therefore, you should not do anything with the tree until you're completely done processing the input, after the while loop. So simply move the
line to after the end of the loop.$Format->format($TreeBuilder);
print HTML::FormatText->new->format( HTML::TreeBuilder->new->parse_fil +e($_)) for @ARGV;
|
|---|