in reply to Passing Array to Function for search and Replace
@_ =~ s/.../.../g;
should be
$_ =~ s/.../.../g;
or just
s/.../.../g;
$_ is aliased to the current member of @_ by the foreach loop.
==string
should be
eqstring
See perlop for the difference.
checkCurrency($hardwareValue1, $hardwareValue2); sub checkCurrency{ for (@_) { if ($currency eq "Euro (EUR)") { s/€//g; }elsif ($currency eq "Japan, Yen(JPY)") { s/Â/ /g; }elsif ($currency eq "United Kingdom, Pound(GBP)") { s/Â/ /g; } } }
Of course, the real problem is that you're not using Encode's decode to translate UTF-8 bytes into characters, and later Encode's encode to translate the characters into the proper encoding (or Encode's from_to to do it in one step).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing Array to Function for search and Replace
by ikkon (Monk) on Jan 08, 2007 at 18:42 UTC | |
by ikegami (Patriarch) on Jan 08, 2007 at 18:50 UTC |