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:

> hello list
> i am trying to print the output of a parsing script to a file- the way 
> it
> is right now, the print commands are within a foreach loop, and it 
> prints
> to the screen. in order to get the entire output into a file, i'm 
> using a
> simple set of commands like so:
>
>       foreach my $key (keys %alignments) {
>     print "$key\nXXXXXXXXXXXX\n", $alignments{$key}, "\nXXXXXXXXXXX\n";
>
>     open (OUT, '>outputfile.txt') or die "couldn't";
>     print OUT "$key\nXXXXXXXXXXXX\n", $alignments{$key}, 
> "\nXXXXXXXXXXX\n"
> }
>
> print $ending_annotation;
> exit;
>
> the output to the screen prints the entire output correctly, but when i
> open the file output.txt i get only the last item in my output, not the
> entire list..
>
> any help appreciated..
>
> many thanks
> nandita.
>
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to