in reply to Re: Can @ARGV work within Perl functions or is it just for script input?
in thread Can @ARGV work within Perl functions or is it just for script input?

you could, if you were sufficiently perverse, do this (without affecting @ARGV in the calling context)...

One thing to bear in mind doing that is that shift inside the subroutine will still act on @_, and will not magically transfer it's allegiance to @ARGV.

$ perl -le ' > sub x > { > local @ARGV = @_; > print while $_ = shift; > print qq{->@ARGV<-}; > print qq{->@_<-}; > } > > x( qw{ 1 2 3 } ); > print while $_ = shift;' a b c 1 2 3 ->1 2 3<- -><- a b c $

I hope this is of interest.

Cheers,

JohnGG