这种情况不断的网数组@arr2里放入数据,返回的内容为: 这种情况是一维数组: while( $selStmt->fetch() ){ print "$a1 is $a1 "; print "$a2 is $a2 "; print "$a3 is $a3 "; push (@arr2, "$a1 $a2 $a3" ); }; $c->render(json => @arr2); }; http://192.168.32.101:3000/api/auto_publish/publish_info?env=uat 返回结果: ["121.40.189.90 uat-frontend uat","121.40.100.198 zjzc-hy-pre-01 uat","121.40.100.198 zjzc-hy-core-01 uat"] 另外一种情况,返回二维数组: foreach (@arr){ ##2015-11-04 15:51:54,134 DEBUG com.zjzc.thirdparty.sms.SMSSendThread ##2016-03-09 09:35:12,380 INFO com.zjzc.thirdparty.sms.SMSUtils - Send message:您的验证码为132435,本验证码5分钟内有效。 to phoneNo:18072722237 succeed! if ($_ =~ /([0-9]{4}-[0-9]{1,2}-[0-9]{2}s+[0-9]{2}:[0-9]{2}:[0-9]{2}.*?)s+(.*?Send message:)s*(.*?)(tos+phoneNo:s*[0-9]{11}).*/){ $a1=$1; $a2=$2; $a3=$3; $a4=$4; ##微信是UTF-8字符集 my $endtime=strftime("%Y%m%d%H%M%S",localtime()); my $d=encode_utf8('验证'); if ($a3 =~/$d/){ #$msg->reply("@$friend $a1-$a3-$a4"); $a3=decode_utf8("$a3"); ##encode("utf8",decode("gbk","格式为:中均/温金 客户手机号")) #@content=($a1,$a3,$a4); my @content=("$a1","$a3","$a4"); my $href= @content; push (@arr_out ,$href); } }; };