OOOOOMMMMMMMMM!!!!!

Hello perl gurus...I've been struggling with reformatting the output of data in HTML::TableExtractor. Here is ultimately what I want to do: 1) Go to website 2) Scrape table on website based on their location on the page, because there are no freakin headers! 3) Pull the information gathered into a mysql database

So far, here is what I've gotten:

use lib qw( ..);
use HTML::TableExtract;
use LWP::Simple;
use Data::Dumper;
my $te = new HTML::TableExtract( depth=>3, count=>0, gridmap=>0);
my $content = get("http://www.servpro.com/locator/lookup.asp?stname=Alabama&state=AL");
$te->parse($content);
foreach $ts ($te->table_states)
{
foreach $row ($ts->rows)
{
print Dumper $row;
# print Dumper $row if (scalar(@$row) == 2);
}
}

If you save the above, and run it from your cmd prompt, it creates a very messy return, but hey, at least its something right! What I want to do is structure the data into an array so I can send the information to a mysql database.

I have no idea how to get HTML::TableExtractor to bring in an orderly fashion. I've tried to see what it is returning by simply printing one of the variables (like $row rather than using the DUMPER function) HTML::TableExtractor is tabulating, and it comes back by printing something like: "ARRAY(0x1b3243f)ARRAY(0x1b3432)"

First off, what are the strange things it is returning? I've never used dumper, but don't really like it. I would prefer to set a new string equal to each variable in the array. Then send that information to mysql.

One other quick question, can anyone tell me in plain english what
"foreach $ts ($te->table_states)" is telling the computer program to do?

Any help is greatly appreciated...hope everyone has a good weekend! :)

I need to go meditate after working on this stupid thing all day! OOOOOOOOOOOOOOOMMMMMMMMMMMMMMMMMMMMM


In reply to PERL HTML::TableExtractor by jdlev

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.