in reply to Re: How to Identify a language
in thread How to Identify a language

If you want to use code-point ranges, Unicode property classes (see perlunicode) are pretty handy.
sub identify_CJK { local $_ = shift; return "J" if /\p{Hiragana}|\p{Katakana}/; return "K" if /\p{Hangul}/; return "C" if /\p{Han}/; return "Others"; # Note that the order matters because Japanese text # most likely contains Hanzi (Kanji) characters and # so does Korean text (less frequently though). }
I think it works in most cases as long as all the texts you want to test are converted to Perl's internal representation of strings (with utf8 flag on).