This is built-in behavior in Perl. From perlrun:
The null filehandle <> is special: it can be used to emulate the behavior
of sed and awk. Input from <> comes either from standard input, or from
each file listed on the command line. Here’s how it works: the first
time <> is evaluated, the @ARGV array is checked, and if it is empty,
$ARGV[0] is set to "-", which when opened gives you standard input. The
@ARGV array is then processed as a list of filenames.
| [reply] |
In that case I would just shift off any required arguments from @ARGV, then process the file list with <> (or manually with open, etc., if I were paranoid about using <>). | [reply] [d/l] [select] |
...just shift off any required arguments from @ARGV...
Exactly. Or, if it makes sense, use something a little more sophisticated, such as Getopt::Long, to extract them from the @ARGV array.
A word spoken in Mind will reach its own level, in the objective world, by its own weight
| [reply] |