我在守则中看到<代码>->,我并不确切知道这意味着什么。 例如:
@top_links = @{$m->links};
这一行文是什么? 而且,我可以在哪里阅读?
我在守则中看到<代码>->,我并不确切知道这意味着什么。 例如:
@top_links = @{$m->links};
这一行文是什么? 而且,我可以在哪里阅读?
See The ArrowOperationtor in perlop:
“
->
是固定参照的操作者,如同C和C++一样。 如果右侧是[...]
,{......}
,或(......)
subscript,则左边必须不是硬性或象征性地提及一个阵列、一个海面或一个小路。 (从技术上讲,如果用阵列或暗指进行转让,则能够持有硬参照的所在地点。) 见,perlreftut 和perlref。否则,右侧就是一个方法名称或包含方法名称或非例行参照的简单缩略变量,左边必须成为物体(无记名)或类别名称(即包装名称)。 见perlobj。
总的来说,->
hints at de reference. 这一辛迪加来自C。
举例来说,它是指从<代码>$ 一般参考文件 Stack Overflow;这是一个经常性议题。
www.un.org/Depts/DGACM/index_french.htm 部分是参考——这意味着<代码>m->links 是个阵列的参比<>>>,因此,该操作者将其引向直接阵列,然后抄到@top_links
。
Camel Book是了解参考资料的一个良好地方,或perlref。
<代码>-> 箭牌操作者为标注,此处指<代码>links member of the $m
Object。 同样,后来的Camel Book各章也详细叙述了针对Perl的物体支持。 See perlobj section of the Perl documentation also.
单枪管操作者有另一种用途:
班级和班级;
但它与你的法典样本完全不同。 仅将其列入标题中,说明问题是否完整。
I am building a Web interface to monitor an embedded system. I have built a Perl script which runs remote commands and gathers output from that system. Now what I need is a Web interface which makes ...
How do I tell what type of value is in a Perl variable? $x might be a scalar, a ref to an array or a ref to a hash (or maybe other things).
When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...
I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...
I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...
I would like to submit a form to a CGI script localy (w3c-markup-validator), but it is too slow using curl and apache, I want to use this CGI script more than 5,000 times in an another script. and ...
So I m running perl 5.10 on a core 2 duo macbook pro compiled with threading support: usethreads=define, useithreads=define. I ve got a simple script to read 4 gzipped files containing aroud 750000 ...
A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...