Note that while shift operates on @_ by default in a subroutine, in the main body of a script it operates on @ARGV, i.e. arguments supplied on the command line. This one-liner illustrates that.
$ perl -E 'say $x while $x = shift' aaa bbb ccc aaa bbb ccc $
I hope this is of interest.
Cheers,
JohnGG
In reply to Re: difficulty in understanding use of @_ and shift in a subroutine
by johngg
in thread difficulty in understanding use of @_ and shift in a subroutine
by masood91
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |