http://www.perlmonks.org?node_id=11105733


in reply to I want to save web pages as text rather than as HTML.

You need a true HTML parser to help you get to the particular nodes that you want. Very good write-up here: http://radar.oreilly.com/2014/02/parsing-html-with-perl-2.html
  • Comment on Re: I want to save web pages as text rather than as HTML.

Replies are listed 'Best First'.
Re^2: I want to save web pages as text rather than as HTML.
by anautismobserver (Sexton) on Sep 06, 2019 at 22:14 UTC

    I apologize for my ignorance.

    When I try to run the first "self-contained example" as written in the provided link, it produces no output (except for "Press any key to continue...").

    When I replace the body of the script (starting with "my $re ="...) with the next code example (that uses "HTML::TokeParser::Simple;"), I get the error message "Can't locate HTML::TokeParser::Simple.pm in @INC"

    Could you please give me a code example that truly is self-contained, that reads (and parses) an HTML file and outputs it as a text file?

    Thank you.

      Could you please give me a code example that truly is self-contained, that reads (and parses) an HTML file and outputs it as a text file?

      Sure, go fish, strip HTML tags