RE: printing output to a file

2002-09-09 Thread Nandita Mullapudi
Thanks ALL for the quick help! i realised my mistake, "open" shd be outside the loop.. :) :) (scripts that work, very pleasing!) nandita -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: printing output to a file

2002-09-09 Thread david
James Edward Gray II wrote: >> open (OUT, '>outputfile.txt') or die "couldn't"; >> print OUT "$key\n\n", $alignments{$key}, >> "\nXXX\n" the reason is in these 2 lines(especially the open() thingy). whenever you ask Perl to open something for writing, Perl turncate t

Re: printing output to a file

2002-09-09 Thread James Edward Gray II
You're real close to what you need here. You're just reopening (and clearing) that file every time through the for loop. Move that open statement to above the loop and everything will start working fine. Good luck. James On Monday, September 9, 2002, at 11:49 AM, Nandita Mullapudi wrote:

RE: printing output to a file

2002-09-09 Thread Timothy Johnson
You need to either a) open your file before the foreach loop, or b) open the file in append mode. When you use this line, "open(OUT, '>outputfile.txt')", Perl opens the file and removes the contents. It truncates the file to 0 bytes. This is because you are using the > operator instead of the

RE: printing output to a file

2002-09-09 Thread Wagner, David --- Senior Programmer Analyst --- WGO
You want the open on the outside of the loop. You are using > on the open, which basically gives you a new clean file each time. You could use >> for appending the data, but there is no reason to open the file repeatedly. Wags ;) -Original Message- From: Nandita Mullapudi [mail