I keep getting: "Use of uninitialized value $fdr..."
The problem arises when I try to assign a numeric value to an array that houses the 10 different variables I'm tryin to give the values to (It's towards the very bottom) Here's my code:
use strict;
use warnings;
use LWP::Simple;
use HTML::TableExtract;
my $money = get("http://finance.yahoo.com /q/ks?s=MNDO+Key+Statistics");
my $p = new HTML::TableExtract();
$p->parse($money);
my $table = $p->table(2,9);
#foreach my $row ($table->rows ()) {
# ! defined and $_ = ' ' for @$row;
# print "$row->[0]\n";
# print "$row->1\n";
# print "@$row\n";
#}
#Forward Annual Dividend Rate = $fdr
#Forward Annual Dividend Yield = $fdy
#Trailing Annual Dividend Rate = $tdr
#Trailing Annual Dividend Yield = $tdy
#5 Year Average Dividend Yield = $fyay
#Payout Ratio = $pr
#Dividend Date = $dd
#Ex-Dividend Date = $edd
#Last Split Factor = $lsf
#Last Split Date = $lsd
my @Dividend_Values = (my $fdr, my $fdy, my $tdr, my $tdy, my$fyay, my $pr, my $dd, my $edd, my $lsf, my $lsd);
for (my $count=0; $count < 11; $count++)
{
my $cell = $table->cell($count,1);
#print "$cell \n";
$Dividend_Values$count = $cell;
}
print $fdr;
I love it when a program comes together - jdhannibal
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|