use Mojolicious::Lite;use JSON qw/encode_json decode_json/; use Encode;no strict;use JSON; use Data::Dumper;#no utf8;# /foo?user=sri post '/admin/api/menu' => sub { my $c = shift; print "测试更健康\n"; my @arr1=(); open (LOG1 ,"<",'/data01/applog_backup/zj-api01-catalina.out') or die $!; while () { my $phone='18072722237'; #2016-03-09 09:35:12,380 INFO com.zjzc.thirdparty.sms.SMSUtils - Send message:您的验证码为132435,本验证码5分钟内有效。 to phoneNo:18072722237 succeed! if ( ($phone) and ($_ =~/$phone/) and ($_ =~/SMSUtils/) ){$str=$_; my $d=encode_utf8('验证'); # my $d='验证'; print "1-------\$str is $str\n"; next if ($str !~ /$d/); print "2--------\$str is $str\n"; push (@arr1 ,decode_utf8($str)); }}; close LOG1; $c->render(json => \@arr1 );}; app->start;