If I use ./test.pl file1 file2
, I know the values are stored in @ARGV
as first and second value, such that $ARGV[0]
equals file 1
and so on.
However if I pass the command as ./test.pl ./folder1/* ./folder2/*
where each folder has 1000 numbered files, how is @ARGV
numbered?
I edited to correct the error in question. $ARGV[1] should be file2, instead of file1 as pointed out in the answers and comments.
@ARGV
is ordered exactly the same way as the parameters are given to it. Now if your asking in what order your shell expands out the wild cards just before it calls perl, then that's a question about the shell of your choice. You may want to replace./test.pl
withecho
and see how it works...$ARGV[1]
equalsfile 1
is wrong.$ARGV[0]
equalsfile 1