2 回答

TA贡献1868条经验 获得超4个赞
请注意,那个是 \1 不是 \l
/(\d{2})([\W])\1\2\1/ 中的 \1被指定为(\d{2})所匹配的值,因此这个正则只能匹配如下字串
17-17-17 或者17.17.17 或者 17%17%17。又或者 18-18-18 20.20.20这样的串
这样明白了么?那个perl教程里这句话没有写得特别清楚,如果多举几个例子读者就会看得更明白一些。

TA贡献1817条经验 获得超6个赞
While the :: symbol can be thought of as similar to the period in a C struct, it is much more akin to the :: class scope operator in C++: a.b.c; /* something in C */ a::b::c(); // function in C++ $a::b::c; # a scalar in Perl 5 @a::b::c; # a list in Perl 5 %a::b::c; # an associative array or "hash" in Perl 5 &a::b::c; # a function in Perl 5
“::”符号可以认为是与C语言中的“.”相似,而它更像C++中的::类范围操作符。
$m = 5;
sub me
{
}
$main::m
&main::me
...
添加回答
举报