Perl 判断字符串为空

前端之家收集整理的这篇文章主要介绍了Perl 判断字符串为空前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
[oracle@jhoa ip_sec]$ cat 2.pl 
$_='{"code":0,"data":{"country":"台湾","country_id":"TW","area":"","area _id":"","region":"台湾省","region_id":"TW_01","city":"","city_id":"","county":"","county_id":"","isp":"","isp_id":"-1","ip":"125.227.116.234"}}';
if ($_ =~ /(.*?)"city":(.*?),(.*?)/){$city = $2};
$city =~ s/"//g ;
print "\$city is $city\n";
if ( ($city) ){print "1111111\n"};
[oracle@jhoa ip_sec]$ perl 2.pl 
$city is 

猜你在找的Perl相关文章