If you run "script add 2 1 3 7 5" then your $ARGV[1]..$ARGV[$len] boils down to 2..5 which is the same as 2,3,4,5. You are close. You want 1..$len and use that to get items from @ARGV. That is called an "array slice" and is written @ARGV[1..$len] (note the @ not $).
- tyeIn reply to Re: Passing Any Range of Values to a Sub (slice)
by tye
in thread Passing Any Range of Values to a Sub
by Dru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |