- 论坛徽章:
- 0
|
from 'perldoc perlsub' and search for '@_' :
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 cre-
ated 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.
from 'perodoc -f shift' :
shift ARRAY
shift Shifts the first value of the array off and returns it, short-
ening the array by 1 and moving everything down. If there are
no elements in the array, returns the undefined value. If
ARRAY is omitted, shifts the @_ array within the lexical scope
of subroutines and formats, and the @ARGV array at file scopes
or within the lexical scopes established by the "eval ''",
"BEGIN {}", "INIT {}", "CHECK {}", and "END {}" constructs.
I don't like to discourage the newbe as you,but I really would not rather see someone ask a basal problem stiffly here before he could read some possible documents at first. |
|