in reply to Re: Write to multiple files
in thread Write to multiple files
while (<DATA>) { chomp; my ($head, $seq) = split / /;
That would be better as:
while ( <DATA> ) { my ($head, $seq ) = split;
my @file_ends = qw{./ .fasta}; ... open my $fh, q{>>}, join($ko, @file_ends);
With three argument open you don't need to prepend the file name with "./" and you should always verify that the file successfully opened before trying to use a possibly invalid filehandle:
my file_end = '.fasta'; ... open my $fh, '>>', "$ko$file_end" or die "Cannot open +'$ko$file_end' because: $!";
|
|---|