I had "use strict" in the program originally, but it seemed to do nothing but cause trouble; it mostly meant that I had to put "my" before almost every variable, so I just got rid of it. I'm also not sure what you mean by lexical file handles and 3-argument open.
The "my" is actually very useful because, apart from catching typos in misspelt variable names, it limits the scope of the variable. A variable declared with "my" is known as a lexical variable because it has lexical scope; that is, its name is known from the point of declaration to the end of the block it is declared in (or end of file if not declared in a block). Hence my recommendation to use lexical file handles (e.g. my $fhin) rather than your global variable bareword file handle IN.

Using lexical file handles is better style because:

As for why the three-argument form of open is preferred, note that the old two-argument form of open is subject to various security exploits as described at Opening files securely in Perl.

See also the first four items of Perl Best Practices Chapter 10 (I/O), namely:


In reply to Re^3: Question about binary file I/O by eyepopslikeamosquito
in thread Question about binary file I/O by TheMartianGeek

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.