#5 Currency Converter

When traveling internationally, it's very easy to become confused by the differences between the various currencies out there. Knowing the exchange rate is vital for international transactions.

Converting between one currency and another is a simple calculation, providing you know the exchange rate. Since rates are continually changing, that can prove to be a bit tricky. This script actually goes to a website maintained by XE.com, downloads the exchange rate, and then performs the calculation. This means that the result will be an accurate conversion using up-to-the-minute rates.

The Code

 1 # 2 # Convert currency from one type to another 3 # 4 # Usage: money.pl <amount><from-code> <to-code> 5 # 6 # Where: 7 # <from-code>, ...

Get Wicked Cool Perl Scripts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.