perl 中$::的含义及用法

问题描述:

perl 中$::的含义及用法
1个回答 分类:综合 2014-11-20

问题解答:

我来补答
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
...
再问: so does it mean $:: equals $main::?
再答: 不是啊,可以加任意的闭包名称的,默认的话变量是在main的闭包里面
 
 
展开全文阅读
剩余:2000
上一页:ghhhhh
下一页:概括每段段意