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