加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Perl中@_的含义是什么?

发布时间:2020-12-15 21:28:37 所属栏目:大数据 来源:网络整理
导读:Perl中@_的含义是什么? 解决方法 perldoc perlvar是检查任何特殊命名的Perl变量信息的第一个地方。 报价: @_ : Within a subroutine the array @_ contains the parameters passed to that subroutine. 更多细节可以发现在perldoc perlsub (Perl subroutin
Perl中@_的含义是什么?

解决方法

perldoc perlvar是检查任何特殊命名的Perl变量信息的第一个地方。

报价:

@_: Within a subroutine the array @_ contains the parameters passed to that subroutine.

更多细节可以发现在perldoc perlsub (Perl subroutines)链接从perlvar:

Any arguments passed in show up in the
array @_ .

Therefore,if you called a function with two arguments,those
would be stored in $_[0] and $_[1].

The array @_ is a local array,but its
elements are aliases for the actual scalar parameters.
In particular,if
an element $_[0] is updated,the
corresponding argument is updated (or
an error occurs if it is not
updatable).

If an argument is an array or hash element which did not exist when the function was called,that element is created only when (and if) it is modified or a reference to it is taken. (Some earlier versions of Perl created the element whether or not the element was assigned to.) Assigning to the whole array @_ removes that aliasing,and does not update any arguments.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读