achilles82 has asked for the wisdom of the Perl Monks concerning the following question:
when I am trying to parse a html page my code is repeating the output manytimes,here IR.htm is any html page
#print"content-type: text/html\n\n"; #require LWP::simple; require HTML::TreeBuilder; require HTML::FormatText; #$URL = get("http://www.scriptsocket.com"); $Format = HTML::FormatText->new; $TreeBuilder = HTML::TreeBuilder->new; open(FILE,"IR.htm"); #$data =<FILE>; while(<FILE>){ chomp $_; $TreeBuilder->parse($_); $Parsed = $Format->format($TreeBuilder); #print "$Parsed"; push(@word,$Parsed); } foreach(@word){ print $_,"\n"; } close FILE; #exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: parsing html file
by jdporter (Paladin) on Oct 09, 2008 at 00:27 UTC |