In a subroutine @_ is a list of the arguments to the call. For example...
mysub(1, 2, 3); sub mysub { print "@_\n"; my $x = shift; print "@_\n"; print "$x\n"; } #Outputs: #1 2 3 #2 3 #1
shift within a subroutine grabs the first argument to the call. So in the example above, 1 will be removed from @_ and assigned to $x.
In reply to Re: shift operator
by FunkyMonk
in thread shift operator
by molly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |