You can use a SOAP service to get the data you need. After a quick Google search, I found a web service to do the work for you. You'll have to have SOAP::Lite installed, though. You can get it from CPAN if you don't. See www.soaplite.com for more info.

Instead of just giving you the exchange rate, however, it gives you a string containing both the exchange rate and the time at which it was valid. You'll have to get the exchange rate off the end of the string. Since you said you wanted to "create a program," I'll leave that part as an exercise for the reader. :-)

You'll want to use the currency codes USD and JPY for US dollars to Japanese yen. See the service home page for more currencies and service specifics.

use SOAP::Lite; die "gimme some currency codes" unless @ARGV == 2; my ($from,$to) = @ARGV; my $rate_str = SOAP::Lite ->proxy('http://www.itfinity.net:8080/soap/exrates/default.asp') ->endpoint('http://www.itfinity.net:8008/soap/exrates/default.asp') ->uri('http://www.itfinity.net/soap/exrates/exrates.xsd') ->GetRate( SOAP::Data->type('string')->name( fromCurr => $from ), SOAP::Data->type('string')->name( ToCurr => $to ), ) ->result; print "$rate_str\n";

hth,
Philgarr

In reply to Re: Currency Exchange Rate Programming by Philgarr
in thread Currency Exchange Rate Programming by bladx

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.