本文介绍了@_在Perl中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Perl中@_是什么意思?

What is the meaning of @_ in Perl?

推荐答案

perldoc perlvar 是检查任何特殊命名的Perl变量信息的第一位.

perldoc perlvar is the first place to check for any special-named Perl variable info.

报价:

更多详细信息,请参见从perlvar链接到的 perldoc perlsub(Perl子例程):

More details can be found in perldoc perlsub (Perl subroutines) linked from the perlvar:

因此,如果您调用带有两个参数的函数,则这些 将存储在$_[0]$_[1]中.

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

数组@_本地数组,但其 元素是实际标量参数的别名. 特别是如果 元素$ _ [0]已更新, 相应的参数已更新(或 如果不是,则会发生错误 可更新).

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).

如果参数是数组 或不存在的哈希元素 当函数被调用时 仅在(且如果)时创建元素 它被修改或对其的引用是 采取. (Perl的某些早期版本 创建元素,无论是否 元素已分配给.)分配给 整个数组@_删除了 混叠,并且不更新任何 争论.

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.

这篇关于@_在Perl中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 19:33