Try

#!/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=&dat +e=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 ',', grep { s/\s{2,}//g; } @$row; print "\n"; } }
Output:
ACME Communications, Inc.,ACME,-$0.43, -$0.67 American Axle & Manufacturing Holdings Inc,AXL,$0.84, $1.02 Arch Chemicals Inc,ARJ,-$0.23, $0.11 Barry (R G) Corporation,RGB,n/a, Boots&Coots/Int Well,WEL,n/a, $999.00 Cameco Corporation,CCJ,n/a, Chevron Texaco Corporation,CVX,$1.29, Cigna Corp,CI,$1.27, $1.46 DTE Energy Company,DTE,$1.26, Gaylord Entertainment Co. (New),GET,n/a, Grant Prideco Inc,GRP,$0.02, $0.04 Grupo Financiero Galicia S.A. - American Depositary Shares Representin +g Class B*,GGAL,n/a, Hardinge, Inc.,HDNG,n/a, Hearst - Argyle Television Series A,HTV,$0.39, $0.11 Home Properties Of Ny Inc.,HME,$0.77, $0.60 Insmed, Inc.,INSM,-$0.33, JP Realty Inc.*,JPR,$0.64, Mge Energy Inc.,MGEE,n/a, OSI Systems, Inc.,OSIS,$0.23, $0.29 OXiGENE, Inc.,OXGN,-$0.23, Pinnacle West Capital Corp.,PNW,$0.57, Plains Resources, Inc,PLX,$0.41, Sun Communities Inc.,SUI,$0.88, $0.92 Superior Energy Service Inc,SPN,$0.07, $0.10 Tanox, Inc.,TNOX,-$0.19, -$0.14 Tyler Technologies Inc,TYL,$0.04,

In reply to Re: Able to Access Table Data But Not Sure How to Display Columns in Row Format by Abstraction
in thread Able to Access Table Data But Not Sure How to Display Columns in Row Format by canguro

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.