gpt4 book ai didi

perl - Perl 中的 -> 箭头有什么作用?

转载 作者:行者123 更新时间:2023-12-03 08:24:47 24 4
gpt4 key购买 nike

我一直在看 ->在代码中,我不确定它是什么意思。例如:

@top_links = @{$m->links};

这条线有什么作用?另外,我可以在哪里阅读有关它的信息?

最佳答案

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/4913280/

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