gpt4 book ai didi

perl - -> 运算符在 Perl 中有什么作用?

转载 作者:行者123 更新时间:2023-12-02 05:38:40 27 4
gpt4 key购买 nike

这个问题在这里已经有了答案:




10 年前关闭。




Possible Duplicate:
What does the -> arrow do in Perl?



我没有 Perl 经验,我需要阅读一些脚本。

我找不到“->”运算符的解释。

你能解释一下'->'运算符在这一行中的作用吗?
$sftp->doSomething( $sPerson, $sCredentials )

最佳答案

The Arrow Operator在 perlop:

"-> " is an infix dereference operator, just as it is in C and C++. If the right side is either a [...] , {...} , or a (...) subscript, then the left side must be either a hard or symbolic reference to an array, a hash, or a subroutine respectively. (Or technically speaking, a location capable of holding a hard reference, if it's an array or hash reference being used for assignment.) See perlreftut and perlref.

Otherwise, the right side is a method name or a simple scalar variable containing either the method name or a subroutine reference, and the left side must be either an object (a blessed reference) or a class name (that is, a package name). See perlobj.

关于perl - -> 运算符在 Perl 中有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8150845/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com