Monday, September 9, 2019
How to count the number of non-English character
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; binmode STDOUT, 'utf8';
open(DATA, shift); binmode DATA, 'encoding(utf-8)'; while (<DATA>) { chomp; s/[A-Za-z]//g; say $_, ' ', length; }
reference:
https://www.perlmonks.org/?node_id=1084035
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment