Are you sure you don't empty @ARGV before trying to use it in the sub? What you say doesn't appear to be true.
>perl -E"Foo::foo(); package Foo; sub foo { say for @ARGV }" a b c a b c
@ARGV is global, even using it's unqualified name. You could also use its fully qualified name, but it's not necessary.
>perl -E"Foo::foo(); package Foo; sub foo { say for @::ARGV }" a b c a b c
@::ARGV is also known as @main::ARGV.
In reply to Re: Scope of ARGV
by ikegami
in thread Scope of ARGV
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |