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?