in reply to Re^2: Extracting raw text from a website
in thread Extracting raw text from a website
Deleting the spurious whitespace which this module adds, is left as an exercise for the reader.use strict; use warnings; use LWP::Simple; use HTML::Strip; my $url = "http://www.perlmonks.org"; my $html = get($url); defined $html or die "Can't fetch HTML from: ",$url; my $hs = HTML::Strip->new(); my $clean_text = $hs->parse( $html ); $hs->eof; print $clean_text;
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |