in reply to (jeffa) 3Re: Text File Parsing / Homegrown Template
in thread text file parsing

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.

Replies are listed 'Best First'.
•Re: Re^4: Text File Parsing / Homegrown Template
by merlyn (Sage) on Jun 18, 2002 at 22:34 UTC
    but I was under the impression that local was going to walk the plank in short order.
    A mistaken impression, I can assure you. Not only will it work through the end of product life in Perl5, but it will also continue to work under the new name temp in Perl6.

    -- Randal L. Schwartz, Perl hacker