in reply to Re^2: How to output the words that you want that came thru an html file?
in thread How to output the words that you want that came thru an html file?

My favourite is HTML::TokeParser. This is a code fragment that finds the next <td> tag and then gets the text in the data cell.
$stream = HTML::TokeParser->new( \$content ) $stream->get_tag('td'); $key = $stream->get_trimmed_text('/td');

perl -e 'print qq(Just another Perl Hacker\n)' # where's the irony switch?

Replies are listed 'Best First'.
Re^4: How to output the words that you want that came thru an html file?
by Anonymous Monk on May 04, 2012 at 13:22 UTC

      This works for me. :-) A few too many blank lines in the output perhaps.

      use Modern::Perl; use HTML::HTML5::ToText; use Web::Magic -quotelike => 'web'; my $converter = HTML::HTML5::ToText->with_traits(qw/ShowLinks/)->new; web <http://www.gamezebo.com/games/marvel-avengers-alliance/walkthroug +h> -> assert_success -> querySelectorAll('div.walkthrough_section') -> foreach(sub { print $converter->process($_); })

      Disclaimer: I'm the author of both HTML::HTML5::ToText and Web::Magic.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'