So I created a nifty little market checking program for my website. I have no idea how to format the perl program though so I can have the info display in a table on a web page, and right now, it is just a line of information. How would i format this code to appear in a table? Or better yet, how could I have another html webpage pull in variable values after running this page? Here is my code:
# create object
my $q = Finance::Quote->new();
# retrieve stock quote
my %data = $q->fetch('NYSE', '^GSPC');
my %data1 = $q->fetch('NYSE', '^DJI');
my %data2 = $q->fetch('NYSE', '^FTSE');
my %data3 = $q->fetch('NYSE', '^HSI');
my %data4 = $q->fetch('NYSE', '^N225');
my %data5 = $q->fetch('NYSE', '^GDAXI');
my %data6 = $q->fetch('NYSE', 'GCQ09.CMX');
my %data7 = $q->fetch('NYSE', 'CLV09.NYM');
my %data8 = $q->fetch('NYSE', '^TNX');
# print price
print "Nikkei 225: " . $data4{'^N225', 'net'}, "\n";
print "Hang Seng: " . $data3{'^HSI', 'net'}, "\n";
print "DAX: " . $data5{'^GDAXI', 'net'}, "\n";
print "FTSE 100: " . $data2{'^FTSE', 'net'}, "\n";
print "S&P 500: " . $data{'^GSPC', 'net'}, "\n";
print "Dow Jones: " . $data1{'^DJI', 'net'}, "\n";
print "Gold: " . $data6{'GCQ09.CMX', 'net'}, "\n";
print "Oil: " . $data7{'CLV09.NYM', 'net'}, "\n";
print "US 10 Year Treasury Note: " . $data8{'^TNX', 'net'}, "\n";
I love it when a program comes together - jdhannibal
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.