CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Able to Access Table Data But Not Sure How to Display Columns in Row Format

 



canguro
New User

May 9, 2003, 3:16 PM

Post #1 of 1 (589 views)
Able to Access Table Data But Not Sure How to Display Columns in Row Format Can't Post

Hello,

I am using code which accesses table data from a webpage. I have gotten the code to display the data values, but each data value is coming out on a separate line. Can someone enlighten me on how to get the 4 column values on one line (row) in this fashion:

a1, a2, a3, a4
b1, b2, b3, b4
.
.
.

I am also wondering if I can somehow 'grab' (save) the literal "Earnings Announcements for: Friday, May 2, 2003" which displays as a title above the table, since the date is crucial. Here is the code I have built so far:

#!/usr/bin/perl

use warnings;
use strict;
use LWP::Simple;
use HTML::TableExtract;

my $url;
$url="http://www.earnings.com/fin/earnListing.jsp?tckr=&exch=&eff=&date=2003-05-04";
my $content=get $url;
my $te = new HTML::TableExtract( headers =>
qw(Company Symbol Estimate Actual) );
$te->parse($content);

# Examine all matching tables
foreach my $ts ($te->table_states) {
print "Table (", join(',', $ts->coords), "):\n";
foreach my $row ($ts->rows) {
print join(',', @$row), "\n";
}
}

Many thanks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives