James Edward Gray II wrote:

>>     open (OUT, '>outputfile.txt') or die "couldn't";
>>     print OUT "$key\nXXXXXXXXXXXX\n", $alignments{$key},
>> "\nXXXXXXXXXXX\n"

the reason is in these 2 lines(especially the open() thingy). whenever you 
ask Perl to open something for writing, Perl turncate the file for you if 
the script have the permission to do so. that means everytime your open() 
statement success, what is previous in your 'outputfile.txt' will be 
turncate to an empty file. following the open() statment, you have a 'print 
OUT ...' statment which sends a signle line to 'outputfile.txt'. that will 
thus be the only line you will see your output file. to fix this, you can 
open your file in append mode like:

open(OUT,'>>outputfile.txt') || die $!;
print OUT 'your usual stuff\n';

but there is little reason for that because you can simply move your open() 
statement outside of your foreach loop.

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to