/n 阻止 分组元字符()捕获,这是修饰符,在新的5.22 会停止 $1,$2 等填充
对捕获的 不记录到$1,$2,$3中
[oracle@oadb scan]$ cat a1.pl
if ("hello world" =~ /(hi|hello)/){print "$1 is $1
";};
[oracle@oadb scan]$ perl a1.pl
$1 is hello
centos6.5:/root/scan#cat a1.pl
if ("hello world" =~ /(hi|hello)/n){print "$1 is $1
";};
centos6.5:/root/scan#perl a1.pl
$1 is
这个等同于 放置 ?: 在每个捕获分组的开始
centos6.5:/root/scan#cat a2.pl
if ("hello world" =~ /(?:hi|hello)/){print "$1 is $1
";};
centos6.5:/root/scan#perl a2.pl
$1 is