in reply to Re^4: Sub hash param by reference
in thread Sub hash param by reference
Hello hankcoder,
I'm not quite understand what is $_[0]
The special variable @_1 is documented as follows:
Within a subroutine the array @_ contains the parameters passed to that subroutine. Inside a subroutine, @_ is the default array for the array operators pop and shift.
Now, in Perl2 you access the individual elements of array @my_array as $my_array[0], $my_array[1], $my_array[2], .... (Note that the first element has index zero.) In the same way, the array @_ (which is named “ _ ”) has elements $_[0], $_[1], $_[2], .... So $_[0] is the first parameter passed to the subroutine.
1You can also call it @ARG if you use English; — see perlvar#General-Variables.
2That is, Perl 5 and earlier. I believe Perl 6 uses a different syntax.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Sub hash param by reference
by hankcoder (Scribe) on Jul 10, 2016 at 12:46 UTC |