As described in perlvar, $ARGV "contains the name of the current file when reading from <>."
When iterating over a file using the -n switch (as you're doing ... described in perlrun), the <> operator is silently being invoked behind the scenes, which is why $ARGV is relevant.
Dave
In reply to Re: how to get the input file name when perl script runs from the command line?
by davido
in thread how to get the input file name when perl script runs from the command line?
by greatshots
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |