in reply to Re: How to extract text between two tags?
in thread How to extract text between two tags?

Many will complain that you should use an xml parser, however

You don't need an XML parser to parse html, HTML::TreeBuilder will do just fine

  • Comment on Re^2: How to extract text between two tags?

Replies are listed 'Best First'.
Re^3: How to extract text between two tags?
by bitingduck (Deacon) on May 28, 2015 at 22:46 UTC
    Not only will HTML::TreeBuilder do fine, but if it's an HTML file an XML parser is likely to die quickly on it. XML parsers are required to fail on invalid XML, while HTML parsers are allowed to be more forgiving (e.g. HTML::TreeBuilder defaults to inserting implicit end tags that would cause an XML parser to quit)