Cut your code down to a minimal (preferably 15 lines or less), compliable script which reproduces the problem. At that point, you have a far better chance that the (busy) Monks will be able to take the time to help...

... and, in doing so, you may well discover why the 317 line versions fails. This is way too much code for a very basic question.

But, in the interest of demonstrating our desire to help you learn, you should modify your code to test the open at 137. Instead of

open (I16S,"$in16S");

test the open (and specify that you are opening for a read):

open (I16S, "<", "$in16S" or die "Can't open $fh for read: $!;"

And while you're at it, look at using variables instead of raw filehandles; e.g., $fh as the first element insde the parens) and (perhaps; as I said, 300+ lines is too much of a burden) use a meaningful name for the var, $in16S.


In reply to Re: readline on closed filehandle error by ww
in thread readline on closed filehandle error by Oapples

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.