in reply to output file gives only last line
from what code you have posted
{ print "pos $i $testseq\n"; open OUT, ">results5"; print OUT "pos $i $testseq\n"; close OUT; }
You have print statements which print to your screen but when you open the file and print to the file using print filehandle i.e. print OUT ..It prints to the file..So only the last print stmt shows up in the file .You can open this file at the beginning of the loop and change all print statements to print filehandle i.e. print OUT
as an alternative you can redirect the stdout of your script by redirecting it to a file like below (so that it will write all print statements to your log file)
perl script1.perl >> script1.log #redirect stderror Also as below perl script1.perl >> script1.log 2>&1
|
|---|