Oh monks most exalted and wise, a humble novice seeks to benefit from your vast knowledge of all things Perl.
I have a text file (UTF8-encoded) containing words, one per line, and I'm interested in finding out, for each word, how many characters are in it that do not appear in the English alphabet. So I whipped up a script to find out:
use open IO => ':utf8';
($nonenglish = $_) =~ s/[A-Za-z]//g;
print length($nonenglish), " $nonenglish\n";
Alas, it isn't working; length appears to be counting bytes rather than characters! To wit:
$ perl nonenglish.pl
I only occasionally use Perl, and I have no idea what I'm doing wrong. Enlighten me, kind monks, I beseech you!
My Perl is 5.14.2, BTW (and I cannot easily upgrade).