Use…
binmode(STDOUT, ':encoding(UTF-8)');
…instead of…
binmode(STDOUT, ":utf8");
Likewise, use…
open HASH, '<:encoding(UTF-8)', 'test_hash.txt'; ... open INPUTFILE, '<:encoding(UTF-8)', 'test_input.txt';
…instead of…
open HASH, '<:utf8', "test_hash.txt"; ... open INPUTFILE, '<:utf8', "test_input.txt";
Also, this looks wrong to me:
my @word = $entry =~ /(\X)/g;
Shouldn't that be…
my @word = $entry =~ /(\X+)/g;
…instead?
UPDATE: Upon reexamination, it looks right to me. :-/ Using the variable name @letters instead of @word would be an improvement, though. Then…
for my $letter (@letters) { my @input_features = @{ $hash{$letter} }; print join(" ", @input_features) . "\n"; }
In reply to Re: Unicode combining characters as hash keys?
by Jim
in thread Unicode combining characters as hash keys?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |