1 回答

一只名叫tom的貓
TA貢獻1906條經(jīng)驗 獲得超3個贊
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
“::”符號可以認(rèn)為是與C語言中的“.”相似,而它更像C++中的::類范圍操作符。
$m = 5;
sub me
{
}
$main::m
&main::me
...
添加回答
舉報
0/150
提交
取消