use strict; use constant RATES => { 'Austrian schilling' => 13.76, 'Belgian franc' => 40.3399, 'Dutch guilder' => 2.20371, 'Finnish markka' => 5.94573, 'French franc' => 6.55957, 'German mark' => 1.95583, 'Greek drachma' => 340.75, 'Irish punt' => 0.787564, 'Italian lira' => 1936.27, 'Portuguese escudo' => 200.482, 'Spanish peseta' => 166.386 }; sub toEuro { my ($currency,$amount) = @_; if(exists(RATES->{$currency})) { return RATES->{$currency} * $amount; } return; } sub toCurrency { my ($currency,$amount) = @_; if(exists(RATES->{$currency})) { return $amount / RATES->{$currency} ; } return; } # Test output :) print toEuro('French franc',10); print "\n"; print "\n" . toCurrency('French franc',toEuro('French Franc',10));
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Calc::Euro (Re: The Euro)
by Juerd (Abbot) on Jan 02, 2002 at 04:50 UTC | |
by tstock (Curate) on Jan 02, 2002 at 08:22 UTC | |
by simon.proctor (Vicar) on Jan 02, 2002 at 14:29 UTC | |
by Juerd (Abbot) on Jan 02, 2002 at 15:46 UTC | |
|
Re: The Euro
by davorg (Chancellor) on Jan 02, 2002 at 15:16 UTC | |
by Anonymous Monk on Jan 02, 2002 at 18:12 UTC | |
by davorg (Chancellor) on Jan 02, 2002 at 18:32 UTC | |
|
Re: The Euro
by domm (Chaplain) on Jan 02, 2002 at 15:36 UTC | |
|
Re: The Euro
by TomK32 (Monk) on Jan 02, 2002 at 03:27 UTC | |
by VSarkiss (Monsignor) on Jan 02, 2002 at 04:16 UTC | |
by Juerd (Abbot) on Jan 02, 2002 at 03:51 UTC | |
by tstock (Curate) on Jan 02, 2002 at 08:25 UTC |