为了账号安全,请及时绑定邮箱和手机立即绑定

求问一下,在perl 中$::的含义及用法?

求问一下,在perl 中$::的含义及用法?

千万里不及你 2021-09-08 06:07:21
如题,谢谢
查看完整描述

1 回答

?
一只名叫tom的猫

TA贡献1906条经验 获得超2个赞

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
...

查看完整回答
反对 回复 2021-09-13
  • 1 回答
  • 0 关注
  • 262 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信