In my script I am dealing with opening files and writing to files. I found that there is some thing wrong with a file I try to open, the file exists, it is not empty and I am passing the right path to file handle.
I know that my question might sounds weird but while I was debugging my code I put the following command in my script to check some files
system ("ls");
Then my script worked well, when it’s removed it does not work correctly anymore.
my @unique = ("test1","test2");
open(unique_fh,">orfs");
print unique_fh @unique ;
open(ORF,"orfs")or die ("file doesnot exist");
system ("ls");
while(<ORF>){
split ;
}
@neworfs=@_ ;
print @neworfs ;
You did not close the filehandle before trying to read from the same file.