Jeri has asked for the wisdom of the Perl Monks concerning the following question:
I get the error "readline() on closed filehandle $INFILE at Fileappendor.pl line 20."
This is a simple example of my problem. I can't seem to figure it out. Even if I don't ever close the filehandle, I still get the error. I feel like this is a conceptual newbie mistake. Can someone please address what I'm doing wrong? Thanks in advance.
#!usr/bin/perl5.8.8 use strict; use warnings; fileappendor(); sub fileappendor { my $fileno = 1; my $outfile = "proteintable"; open (my $OUTFILE,">", $outfile); while($fileno <= 152) { my $infile = $fileno."_FamDATA"; open (my $INFILE,"<", $infile); while(<$INFILE>) { print $OUTFILE $_; } close ($INFILE); $fileno++; } } #end of sub fileappendor
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: readline() on closed filehandle
by toolic (Bishop) on Oct 07, 2011 at 21:02 UTC | |
|
Re: readline() on closed filehandle
by ww (Archbishop) on Oct 07, 2011 at 23:59 UTC | |
by choroba (Cardinal) on Oct 08, 2011 at 08:24 UTC | |
by ww (Archbishop) on Oct 08, 2011 at 13:24 UTC |