Well... I am not familiar with either of these packages and it is odd, because the example of the table extract comes from the perldoc... but it doesn't return an object. By dumping the variables it did return I got it to work, however. Here is my code.
use WWW::Mechanize; use HTML::TableExtract; $url="http://www.dhl-usa.com/TransitTimes/USTTimeStart.asp?nav=Transit +Times"; $service = "Service"; $arrival = "Arrival Date and Time"; $transit = "Days in Transit*"; my $mech = WWW::Mechanize->new(); $mech->get($url); $frmSvcCalc = "frmSvcCalc"; $mech->form_name($frmSvcCalc); $mech->set_fields( txtOrgZip => "53213", txtDestZip => "60056", ); $mech->field( "hdnAction", "Calculate" ); $mech->submit($frmSvcCalc); my $results2 = $mech->content; $te = HTML::TableExtract->new( headers => ['Service','Arrival Date and + Time','Days in Transit*'] ); $te->parse($results2); foreach $ts ($te->tables) { foreach $row (@$ts) { print join(',', @$row), "\n"; } }
This, for me, prints each row you want on a line with each td separated by a comma, which should get you far enough along :)

Update I was using version 1.08 and looking at docs on search.cpan.org for 2.06, take with a grain of salt :)

                - Ant
                - Some of my best work - (1 2 3)


In reply to Re: Problems with TableExtract by suaveant
in thread Problems with TableExtract by bcdeery

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.