binmode(STDOUT, ':encoding(UTF-8)'); #### binmode(STDOUT, ":utf8"); #### open HASH, '<:encoding(UTF-8)', 'test_hash.txt'; ... open INPUTFILE, '<:encoding(UTF-8)', 'test_input.txt'; #### open HASH, '<:utf8', "test_hash.txt"; ... open INPUTFILE, '<:utf8', "test_input.txt"; #### my @word = $entry =~ /(\X)/g; #### my @word = $entry =~ /(\X+)/g; #### for my $letter (@letters) { my @input_features = @{ $hash{$letter} }; print join(" ", @input_features) . "\n"; }