I use the following, taken directly from the Finance::Quote site, to check securities. If I attempt to check a mutual fund, such as JAVLX, I get the error:

Use of uninitialized value in printf at quote.pl line67.

Any thoughts? Could it be the length of the stock symbol?

#!/usr/bin/perl -w # # Stock-ticker program. # Can look up stocks from multiple # markets and return the results in # local currency. use strict; use Finance::Quote; my $CURRENCY = "USD"; # Set preferred currency here, or empty strin +g for # no conversion. # The stocks array contains a set of array-references. Each reference # has the market as the first element, and a set of stocks thereafter. my @STOCKS = ([qw/australia CML ITE BHP/], [qw/usa MSFT RHAT LNUX AW UDW VICM CSCO NWRE MLM CBYI ROK HD +I LU AMZN INRG LMT LOR DELL INTC CCI QQQ YHOO USAI LVLT SPW AZPN ITWO + AKLM/] ); # These define the format. The first item in each pair is the label, # the second is the printf-style formatting, the third is the width # of the field (used in printing headers). my @labels = (["name", "%12s", 15], ["date", "%11s", 11], ["time", "%10s", 11], ["last", "%8.2f", 8], ["high", "%8.2f", 8], ["low", "%8.2f", 8], ["close", "%8.2f", 8], ["volume","%10d", 10]); my $REFRESH = 120; # Seconds between refresh. # --- END CONFIG SECTION --- my $quoter = Finance::Quote->new(); my $clear = `clear`; # So we can clear the screen. # Build our header. my $header = "\t\t\t\tSTOCK REPORT" .($CURRENCY ? " ($CURRENCY)" : "") + ."\n\n"; foreach my $tuple (@labels) { my ($name, undef, $width) = @$tuple; $header .= sprintf("%".$width."s",uc($name)); } $header .= "\n".("-"x79)."\n"; # Header is all built. Looks beautiful. $quoter->set_currency($CURRENCY) if $CURRENCY; # Set default curren +cy. for (;;) { # For ever. print $clear,$header; foreach my $stockset (@STOCKS) { my ($exchange, @symbols) = @$stockset; my %info = $quoter->fetch($exchange,@symbols); foreach my $symbol (@symbols) { next unless $info{$symbol,"success"}; # Skip failures. foreach my $tuple (@labels) { my ($label,$format) = @$tuple; printf $format,$info{$symbol,$label}; } print "\n"; } } sleep($REFRESH); } __END__

In reply to Finance::Quote woes by tekniko

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.