What I'd like to do is to avoid opening fh each time I have a hit, but rather open them all before the while loop.my $ref_db = FastaDb->new($fasta); while( my $seq = $ref_db->next_seq() ) { foreach(@ko_array){ if($seq->header() =~ m/($_)/){ open(OUT, ">>".$outdir.$_.".fasta"); print OUT $seq->header()."\n".$seq->seq()."\n"; close(OUT); } } }
In reply to Write to multiple files by julio_514
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |