看了cu上的帖子: http://bbs.chinaunix.net/viewthread.php?tid=907172 于是: sub is_utf8 { my $r = shift; return 1 if ($$r =~/[\x01-\x7f]|[\xc0-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/); return 0; } sub is_gbk { my $r = shift; return 1 if ($$r=~/[\xb0-\xf7][\xa0-\xfe]/); return 0; } 可是不准确, 一段文字是utf8或是gb2312的都同时可以被成功匹配 为何?