mtaivalmaa has asked for the wisdom of the Perl Monks concerning the following question:
I can't get the $ans to return any value when used in the $myhash{$ans,'price'}; statement. The first part print $ans . "-" works fine. Why wont the $ans variable work in the function? I have tried a static variable and it works fine. Thanks Mike ************************************************ #!/usr/bin/perl use Finance::Quote; open (SLIST,"</scripts/test.txt"); @stocks = <SLIST>; close (SLIST); $q = Finance::Quote->new; $cc = 'usa'; $symb = 'WTVN.PK'; %myhash = $q->fetch($cc,@stocks); foreach $ans (@stocks){ print $ans ."-". $myhash{$ans,'price'}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Finance::Quote; and foreach
by runrig (Abbot) on Apr 03, 2006 at 05:48 UTC | |
by mtaivalmaa (Initiate) on Apr 03, 2006 at 13:53 UTC | |
|
Re: Finance::Quote; and foreach
by bowei_99 (Friar) on Apr 03, 2006 at 06:02 UTC | |
by runrig (Abbot) on Apr 03, 2006 at 16:29 UTC |