[LA.pm] stuck with pulling out variables from a reference

David Heayn david at cloudgraphics.com
Sat May 28 09:46:35 PDT 2005


hi, i've been playing with the tableextract module for a few hours 
now and i really like it.

i have found a problem that i can't quite solve myself.

basically, i'm trying to extract earnings data from a stock site. i'm 
stuck at the point where i can grab the table itself. however, i want 
to convert the individual cells to their own variables (ie Q1->$Q1, 
Q2->$Q2...) and i'm lost with the sample code. could you point me in 
the right direction?

many thanks!  (code below:)

David Heayn * http://www.cloudgraphics.com * 213/925.3283








#/usr/bin/perl -w

use lib qw( ..);
use HTML::TableExtract;
use LWP::Simple;
use Data::Dumper;


my $url = 
'http://clearstation.etrade.com/cgi-bin/fundamentals?Event=profile&Symbol=mcrs';


   use LWP::Simple;
   my $content = get $url;
   die "Couldn't get $url" unless defined $content;




##########

chomp($content);



print " \n \n 
Earnings....................................................... \n" ;

$te = new HTML::TableExtract(depth => 1, count => 14);

  $te->parse($content);
  foreach $ts ($te->table_states)
  {
     print "Table found at ", join(',', $ts->coords), ":\n";
     foreach $row ($ts->rows)
     	{
        		print "    ", join(',', @$row), "\n";
     	}
  }




More information about the Losangeles-pm mailing list