[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-win32-users
Subject:    Re: Newby syntax help request
From:       =James Birkholz= <j.birchwood () verizon ! net>
Date:       2003-06-28 22:34:59
[Download RAW message or body]

Thanks, NIck, that was exactly the problem! Now I know which parts of the 
book to read first! (When I slow down...)

James


At 02:02 PM 6/28/03, Nick Pomponio wrote:
>James,
>
>It's been a while since I used HTML::TableExtract, but I
>believe that each row from the rows() method is an array
>of cell values for that table row.  The statement:
>
>    $_ = @$row;
>
>attempts to assign the array of all of the cell values
>in the row to the scalar variable "$_".  By default, Perl
>treats this as:
>
>    $_ = scalar( @$row );
>
>which assigns the number of elements in the array to $_.
>
>The easiest way to remedy the problem is to find out
>which cell contains the text you want. For instance, if
>the text is in the first cell of the row, use:
>
>    $_ = $row->[0];
>
>where [0] indexes the first cell. The second cell would
>be [1], etc.
>
>HTH,
>-Nick
>
>At 01:37 PM 6/28/2003, you wrote:
>>Thanks to Rob for helping me get the correct version of  HTML::Parser 
>>past the gates of PPM so I could run HTML::TableExtract.
>>
>>====================
>>Now I can successfully extract table data on web pages, but am having 
>>trouble parsing some text for my web-crawler, since this is my first Perl 
>>code. I've banged my head for an hour, so I'm gonna take a walk and hope 
>>someone can point out what is probably wrong cuz I don't know anything yet.
>>
>>I'm pretty sure my problem is with the line flagged 
>>by  #<=========================
>>I'm trying to parse out the "Showing rows x to y of z" line from the web 
>>page content. It appears that I'm not able to correctly assign the text 
>>from the web page to the $_, because if I manually assign the text 
>>with   $_ = "Showing 1-15 of 70";
>>then everthing works. I'm confused though, because if I print 
>>the    @$row    , it prints fine.
>>
>>===========================
>>$te2->parse($content);
>>  foreach $ts ($te2->table_states) {
>>#   print theOutFile "Table (", join(',', $ts->coords), "):\n";
>>    foreach $row ($ts->rows) {
>>       print theOutFile "StartRow", @$row, "EndRow", "\n";
>>#         $_ = "Showing 1-15 of 70";
>>           $_ = @$row; #<=========================
>>           @theRecs = m/All/;
>>       print theOutFile "TotalElements = ", $#theRecs, "\n";
>>       print theOutFile "StartRec = ", $theRecs[0], "\n";
>>       print theOutFile "EndRec = ", $theRecs[1], "\n";
>>       print theOutFile "TotalRecs = ", $theRecs[2], "\n";
>>
>>    }
>>}
>>===========================
>>
>>TIA,
>>James
>>
>>ps (Sorry if this isn't the most correct list, I'll look into subbing to 
>>a different list later today.)
>>
>>_______________________________________________
>>Perl-Win32-Users mailing list
>>Perl-Win32-Users@listserv.ActiveState.com
>>To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

James Birkholz
admin, Posen-L mailing list and website
http://www.Posen-L.com

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic