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'}; }
In reply to Finance::Quote; and foreach by mtaivalmaa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |