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.

In reply to Re^4: Text File Parsing / Homegrown Template by tadman
in thread text file parsing by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.