I can see where
merlyn is coming from. It is true that
@ARGV and
<> are intertwined, that this behaviour is a fundamental property of Perl, but even so, it's still kind of odd.
This use of
@ARGV is that sometimes irritating "Swiss-Army" property of Perl. Sure, it slices
and dices, but just because you can doesn't mean you should.
merlyn has his reasons for promoting it, I'm sure, but I'm not totally sold.
The thing I don't like about it is that, apart from smelling a little too much of shell-script programming, it isn't re-entrant. If you need to process a sub-file in the same manner, things are going to get a little hairy because you're using a global. You could make it
local, presumably, but I was under the impression that
local was going to walk the plank in short order.
What I'd probably do is sub-class
IO::File and make something that could read from a group (or glob) of files. That way the "file chaining" stuff is safely contained.