use Encode qw( from_to ); ... input ... foreach ($hardwareValue1, $hardwareValue2) { $_ = from_to($_, 'UTF-8', 'iso-latin-1'); } ... output ...