use Encode qw( decode ); open(my $fh, '<', $language_qfn) or die; while (<$fh>) { $_ = decode('UTF-8', $_); ... }