[root@wx03 0724]# cat a2.pl
use Encode;
my $a=<STDIN>;
my $b=encode_utf8('微信');
print "\$b is $b\n";
if ($a =~/$b/){print "success\n";};
[root@wx03 0724]# perl a2.pl
23微信2231
$b is 微信
[root@wx03 0724]# cat a2.pl
use Encode;
my $a=<STDIN>;
my $b=encode_utf8('微信');
print "\$b is $b\n";
if ($a =~/$b/){print "success\n";};
/**************************************
[root@wx03 0724]# perl a2.pl
23微信2231
$b is 微信
success
[root@wx03 0724]# cat a2.pl
use Encode;
use utf8;
my $a=<STDIN>;
my $b=encode_utf8('微信');
print "\$b is $b\n";
if ($a =~/$b/){print "success\n";};
转载于:https://www.cnblogs.com/zhaoyangjian724/p/6199511.html