2 回答

TA貢獻(xiàn)1868條經(jīng)驗(yàn) 獲得超4個(gè)贊
請注意,那個(gè)是 \1 不是 \l
/(\d{2})([\W])\1\2\1/ 中的 \1被指定為(\d{2})所匹配的值,因此這個(gè)正則只能匹配如下字串
17-17-17 或者17.17.17 或者 17%17%17。又或者 18-18-18 20.20.20這樣的串
這樣明白了么?那個(gè)perl教程里這句話沒有寫得特別清楚,如果多舉幾個(gè)例子讀者就會(huì)看得更明白一些。

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超6個(gè)贊
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
“::”符號(hào)可以認(rèn)為是與C語言中的“.”相似,而它更像C++中的::類范圍操作符。
$m = 5;
sub me
{
}
$main::m
&main::me
...
添加回答
舉報(bào)