Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Strip text from HTML

by briac (Sexton)
on Oct 02, 2001 at 04:12 UTC ( [id://116028]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://116028]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-25 14:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found