Each of the above lines needs to be put into a database field in other words in your example you printed:
my @cells = $r->look_down(
_tag => q{td},
width => q{48%},
valign => q{top},
);
Output:
SERVPRO® of Central Alabama II
Wilson, David & Christie
Phone: (205)678-2224
Fax: (205)678-2226
http://www.servpro.com/franchises/enhanced_asp/default.asp?fn=2226
How would I pull out the following information into different variables such as:
$location = SERVPRO® of Central Alabama II
$phone = (205) 678-2224
$fax = (205) 678.2226
$website = http://www.servpro.com/franchises/enhanced_asp/default.asp?fn=2226
Also, I had a few questions about the functions in your code and hope you could tell me what they do in plan english so that I can start implementing them? :)
Here is the code you created:
for my $cell (@cells){
my $bold = $cell->look_down(_tag => q{b});
print $bold->as_text, qq{\n};
for my $item ($cell->content_refs_list) {
next if ref $$item;
print $$item, qq{\n};
}
My first question is on
for my $item ($cell->content_refs_list)
Here is what I understand. The "for" loop is creating a new value for $item for each item in the array ($cell->content_refs_list), correct? So what is the $cell->contents_ref_list creating, and how does it know to create a new line at each break in the data? In general, what does the "->" do, and what does "content_refs_list" refer to?
Next you print $$item. Why use two $$ here?
I think I understand the rest, so if you could explain and help me with the points above, I should be good to go! Thanks for the awesome help...OOOMMMM!!! :)
In reply to Re^2: PERL HTML::TableExtractor
by jdlev
in thread PERL HTML::TableExtractor
by jdlev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |