@_
The special array @_ can be placed in a subroutine to be used to read the arguments passed to a subroutine. The @_ array is specifically designed to hold arguments passed to a subroutine.
|
sub special_array_test
{ $value1 = @_[0]; $value1 = @_[0]; print ($value1 + $value2) }
|
The values from the @_ special array can also be retrieved by using the shift function as follows:
|
sub special_array_test
{ $value1 = shift @_; $value1 = shift @_; print ($value1 + $value2) }
|
Since the shift function uses the @_ special array by default in a subroutine, the subroutine above could also be rewritten as:
|
sub special_array_test
{ $value1 = shift; $value1 = shift; print ($value1 + $value2) }
|
->
The arrow operator or infix dereference operator, is based on the equivalent operator in C, and is used to dereference a reference
|
$hash{ceres} = asteroid; |