Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
What Can I do to make it go away??view_quote.pl: Use of uninitialized value in string ne at C:\scripts\v +iew_quote.pl line 147.
The error only pops up when the float shares falls in the million range. For example, if its only 200,000,000 --then the last array item ${$_}4 is undefined and it gives me that error!! The line 147 points to the line where it has:use Finance::YahooQuote; my @quotes = getcustomquote(["$symbol"], # using custom format ["Float Shares"]); my $found=0; foreach (@quotes) { $found++; if ($found > 1) { print "Only one stock symbol to view allowed."; die; + } my $float; if (${$_}[1] ne "") { if (${$_}[4] ne "") { $float = "${$_}[1],${$_}[2],${$_}[3],${$ +_}[4]"; } else { $float = "${$_}[1],${$_}[2],${$_}[3]"; } } else { $float = "n/a"; } print "$symbol Float Shares: $float"; } unless ($found) { print "No quote info. for symbol: $symbol"; }
What can I do to make this error go away? How can I pre-define ${$_}4 when I don't know the outcome of the number of the shares?if (${$_}[4] ne "") { $float = "${$_}[1],${$_}[2],${$_}[3],${$ +_}[4]"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A confusing Use of uninitialized value
by davido (Cardinal) on Jun 06, 2005 at 04:04 UTC | |
|
Re: A confusing Use of uninitialized value
by brian_d_foy (Abbot) on Jun 06, 2005 at 04:27 UTC | |
|
Re: A confusing Use of uninitialized value
by Zaxo (Archbishop) on Jun 06, 2005 at 04:01 UTC |