develooper Front page | perl.beginners | Postings from February 2002

Re: Stripping HTML

Thread Previous
From:
Jeff 'japhy' Pinyan
Date:
February 26, 2002 23:31
Subject:
Re: Stripping HTML
Message ID:
Pine.GSO.4.21.0202270230360.6311-100000@crusoe.crusoe.net
On Feb 27, Daniel Falkenberg said:

>    $inputSite = "<URL>";
>    $tree = HTML::TreeBuilder->new;
>    $address = "http://" . $inputSite;
>    $request = HTTP::Request->new('GET', $address);
>    $response = $ua->request($request);
>    my $found = 0;
>
>    $tree->parse($response->content);
>    $html_string = $tree->as_HTML;
>    $te = new HTML::TableExtract( headers => [qw(one two three)] );
>    $te->parse($html_string);
>    foreach $ts ($te->table_states) {
>      foreach $row ($ts->rows) {
>        $mRow = "@$row";

You're ASSIGNING to $mRow here...

>      }
>    }
>    print $mRow;

.... so this will only be the last row found.  Maybe you wanted to do

  $mRow .= "@$row";

but I can't be sure.

-- 
Jeff "japhy" Pinyan      japhy@pobox.com      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About