Hi All

I am trying to get data out of some HTML tables, which is largely working. i am having 2 issues and I have no idea how to resolve, and Google has not helped. I am very new to PERL and programming so I don't even know what I should be looking for to solve this issue.

Issue 1: HTML::TableExtract cannot pick up any data for the first cell. I guess this is because this cell is a html link to a *.png file, for example (line 380):

<td><img class="minimizeStyle" src="http://www.risa.com.au/JockeySilks/58035.png" /></td>.

What I would like to do is populate the first cell in each row with the 58035.png (in this case).

Issue 2: Where HTML::TabelExtract find an empty cell, it ignores it, for example (line 391):

<td style="text-align:center"></td>

Instead of ignoring it I would like a "," to be inserted so that when (eventually) a csv file is created everything will be in line.

The code I have at this stage is:

use strict; use warnings; use HTML::TableExtract; use LWP::Simple; my $html = get("http://www.risa.com.au/FreeFields/Results.aspx?Key=201 +3Aug19,VIC,Echuca"); my $te = HTML::TableExtract->new; $te->parse($html); # Table parsed, extract the data binmode STDOUT, ":utf8"; foreach my $table ( $te->tables ) { foreach my $row ($table->rows) { my @values = grep {defined} @$row; print " ", join(',', @values), "\n"; }# Foreach }# Foreach

I hope someone is able to point me in the right direction.

Cheers

Mr Bigglesworth


In reply to HTML::TableExtract issues by Mr Bigglesworth

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.