是啥意思呢?央台有央视直播在线观看13台的吗>>

Perl中的符号 -&、=& 和 :: 分别表示什么意思? - CSDN博客
Perl中的符号 -&、=& 和 :: 分别表示什么意思?
What do the -&, =& and :: symbols mean?  The -& is the "infix dereference operator". In other words it is the means by which one calls a sub with a pass by reference (among other things you can do with -&). As stated above most things in calls to perl/Tk routines are passed by reference. The -& is used in perl just as in C or C++. (Most of the widget primitives are elements of the Tk:: "perl class".) A simple example of dereferencing would be: $x = { def =& bar }; # $x is a reference to an anon. hash print $x-&{def},"/n"; # prints ``bar''  Note that in the case of calling perl/Tk subs there may be more than one way to call by reference. Compare my($top) = MainWindow-&  with my($top) = new MainW  But in general you will be making extensive use of calls like: $top -& Widge-  There is a clear and succint discussion of references, dereferences, and even closures in man perlref(1) or see the perl 5 info page at: /perlinfo/perl5.html  The use of the =& operator is quite common in perl/Tk scripts. Quoting from man perlop(1):  The =& digraph is simply a synonym for the comma operator. It's useful for documenting arguments that come in pairs.  You could say that =& is used for aesthetic or organizational reasons. Note in the following how hard it is to keep track of whether or not every -option has an argument: $query -& Button(-in,/$reply,-side,'left',-padx,2m,-pady, 2m,-ipadx,2m,-ipady,1m)-&pack(-side,'bottom');  As opposed to: $query -&Button( -in =& /$reply, -side =& 'left', -padx =& 2m, -pady =& 2m, -ipadx =& 2m, -ipady =& 1m )-&pack(-side =& 'bottom');  By the way if you wanted the numeric "greater than or equal" you would use &= not =&.  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  It is also analogous to the single forward quotation mark in perl 4: $main' # a $foo scalar in perl 4 $main:: # a $foo scalar in Perl 5  For backward compatibility perl 5 allows you to refer to $main'foo but $main::foo is recommended.  译文:  符号-&,=&和::分别表示什么意思?  ‘- &’符号是“插入式解引用操作符”(infix dereference operator)。换句话说,它是调用由引用传递参数的子程序的方法(当然,还有其它的作用)。正如我们上面所提到的,在调用Perl/Tk的函数的时候,大部分参数都是通过引用传递的。Perl中的‘-&’功能就和它们在C或C++中一样。(大部分原始的组件都是Tk中的Perl类的元素。)下面是一个简单的解引用的例子:  $x = { def =& bar }; # $x是指向一个匿名hash的引用  print $x-&{def},"/n"; # 输出``bar''  注意,在调用Perl/Tk的子程序时有多种不同的方法进行引用。我们可以比较一下:  my($top) = MainWindow-&  和  my($top) = new MainW  两种方法的不同。  但是,一般来说我们通常都使用这样的方法调用:  $top -& Widge-  在perlref的手册页中有详尽的关于引用、解引用、和闭包的讨论,或者也可以在下面的网页上查看Perl5的信息页:  /perlinfo/perl5.html  在Perl/Tk的脚本中‘=&’操作符时很常见的。perlop手册页中说:关系操作符=&只是逗号操作符的替代物,它在显示成对的参数时非常有用。  你可以认为=&只是为了程序的美观和易维护而被使用的。请看,在下面的例子中,要想监测是否每个选项都有对应的值,是多么的困难:  $query -& Button(-in,/$reply,-side,'left',-padx,2m,-pady,  2m,-ipadx,2m,-ipady,1m)-&pack(-side,'bottom');  而下面的这个则相反:  $query -&Button( -in =& /$reply,  -side =& 'left',  -padx =& 2m,  -pady =& 2m,  -ipadx =& 2m,  -ipady =& 1m  )-&pack(-side =& 'bottom');  顺便说一下,如果你需要用数字“大于等于”的符号,你应该用“&=”而不是“=&”。  “::”符号可以认为是与C语言中的“.”相似的,而它更像C++中的::类范围操作符。  a.b.c; /* C语言中的 */  a::b::c(); // C++ 中的函数  $a::b::c; # Perl 5中的标量  @a::b::c; # Perl 5中的列表  %a::b::c; # Perl 5中的关联数组(或叫hash)  &a::b::c; # Perl 5中的函数  另外,Perl4中的单撇号也具有相同的功能:  $main' # Perl 4中的标量$foo  $main:: # Perl 5中的标量$foo  出于向后兼容的考虑,Perl5也运行使用$main'foo,但是仍推荐使用$main::foo。
本文已收录于以下专栏:
相关文章推荐
关于类名后加&符号,不知道为什么要怎么做?是什么用意?
class CData
CData& fun(CData& a,CData& b)
在PHP中&符号即传的是变量的引用而不是拷贝,引用意味着用不同的名字访问同一个变量内容。这并不像 C 的指针,它们是符号表别名。注意在 PHP 中,变量名和变量内容是不一样的,因此同样的内容可以有不同...
HDU 5505 GT and numbers(对于被我无意识坑到的3个人我表示抱歉)----BestCoder Round #60
请问在上面的一行声明中“AutoEventWireup”、“Codebehind”、“Inherits”分别表示什么意思?
AutoEventWireup --- 指示是否自动...
TortoiseSVN是什么
TortoiseSVN是windows下其中一个非常优秀的SVN客户端工具。通过使用它,我们可以可视化的管理我们的版本库。不过由于它只是一个客户端,所以它不能对版本库进...
请问在上面的一行声明中“AutoEventWireup”、“Codebehind”、“Inherits”分别表示什么意思?
AutoEventWireup --- 指示是否...
http://zjw86212./blog/static//
  const用在成员函数后   主要是针对类的const对...
他的最新文章
讲师:吴岸城
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)后使用快捷导航没有帐号?
查看: 9337|回复: 5
最后登录在线时间273 小时活跃值5400 金币78 注册时间阅读权限1主题精华8积分1820帖子
布衣, 积分 1820, 距离下一级还需 180 积分
最后登录注册时间
刚在直播的&拉呱&不错,很有意思,很好看.小么哥搭词@@@
对整个世界而言,您只是一粒尘埃,对我而言,您却是我的整个世界!
最后登录在线时间80 小时活跃值914 金币30 注册时间阅读权限1主题精华0积分532帖子
头像被屏蔽
布衣, 积分 532, 距离下一级还需 1468 积分
最后登录注册时间
提示: 作者被禁止或删除 内容自动屏蔽
最后登录在线时间22 小时活跃值0 金币0 注册时间阅读权限1主题精华0积分215帖子
头像被屏蔽
庶民, 积分 215, 距离下一级还需 285 积分
最后登录注册时间
提示: 作者被禁止或删除 内容自动屏蔽
最后登录在线时间305 小时活跃值0 金币147 注册时间阅读权限1主题精华12积分10480帖子
头像被屏蔽
进士, 积分 10480, 距离下一级还需 9520 积分
最后登录注册时间
提示: 作者被禁止或删除 内容自动屏蔽
最后登录在线时间79 小时活跃值1326 金币10 注册时间阅读权限1主题精华1积分484帖子
头像被屏蔽
庶民, 积分 484, 距离下一级还需 16 积分
最后登录注册时间
提示: 作者被禁止或删除 内容自动屏蔽
最后登录在线时间0 小时活跃值1 金币0 注册时间阅读权限1主题精华0积分1帖子
头像被屏蔽
无名氏, 积分 1, 距离下一级还需 199 积分
最后登录注册时间
提示: 作者被禁止或删除 内容自动屏蔽
新用户注册后到齐鲁社区任务社区完成“新人报道”/home.php?mod=task任务后即可申请该勋章
齐鲁文苑版块精英
版权所有: 齐鲁网 All Rights Reserved 鲁ICP备号

参考资料

 

随机推荐