in reply to Strip text from HTML

Nice one, here's how to do it using the HTML::Parser v.3 interface

#!/usr/bin/perl -w use strict; use HTML::Parser 3; my $parser = HTML::Parser->new( text_h => [ sub { print shift }, 'dtext' ] )->parse_file(*DATA); __DATA__ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-12 +52"> <title>Index</title> </head> <body> <h1>Hello World</h1> <p>Just Another <p>Parser Hack </body> </html>

Cheers,
briac

Replies are listed 'Best First'.
Re: Re: Strip text from HTML
by tachyon (Chancellor) on Oct 02, 2001 at 05:52 UTC

    Now that is a brief hack! I've got used to the v2 interface because it is so simple although the code always seems a little gawky. You've inspired me to have another go at learning the version 3 interface.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print