Good day Bros. I am getting Inappropriate I/O control operation when trying to open some text files. I have been coding Perl for a long time and this has never happened to me, so I'm a little flummoxed. I originally tried to do the open with the typeglob IN which I have always used before. I researched it a little and found some suggestions that this can cause the error and it was better practice to use a lexical filehandle, so I did so:
#!/usr/bin/perl -w use strict; $| = 1; my @coders = qw(kristin madison scott sean steve zeb); my @files = qw( 17524106 18033790 19683851 27033992 3987896 4058888 4139141 4454294 5303897 5380762 ); foreach my $f (@files) { foreach my $c (@coders) { my $fn = "round1/$c/$f\.txt"; open(my $in, $fn); print "$f\t$c\t$!\n"; close $in; } }
Every open returns an output like 17524106    kristin    Inappropriate I/O control operation Another strange thing is that the above is a pared-down version of a script that actually processes the data in the files. When I ran that, it read and processed the files for some of the @coders (I/O error notwithstanding) but not the others.

Not sure what I'm doing wrong or how to fix it. Suggestions?


In reply to Inappropriate I/O control operation by cormanaz

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.