您的位置:首页 > 其它

Error in perl matching

2015-01-04 13:40 127 查看
We got this error by running:

 

my $str = "reb,cheng";

$str = ~ s/,//;

print $str, "\n";

 

seems everything is okay, but why?

Here is the error message:

C:\Rebecca\script\perl>perl status_v0.2_clear.pl

Use of uninitialized value $_ in substitution (s///) at status_v0.2_clear.pl line 88, <DATA> line 751.

18446744073709551615

 

Notice there is a space between “=” and “~”, the correct way should be
NO SPACE between them:


my $str = "reb,cheng";

$str = ~ s/,//;

print $str, "\n";;

 

then we got:

C:\Rebecca\script\perl>perl status_v0.2_clear.pl

rebcheng

 

It is executed successfully after removing the space!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  perl
相关文章推荐