in reply to Re: I'm trying to print the contents of a hash to newly created files
in thread I'm trying to print the contents of a hash to newly created files

Thank you, sir. I've incorporated your advice into my code in conjunction with advice about how I open my file handle and it seems to be working. Here's how my code looks now:
my %id2seq = (); my $id = ''; open File,"human_hg19_circRNAs_putative_spliced_sequence.fa",or die $! +; while(<File>){ chomp; if($_ =~ /^>(.+)/){ $id = $1; }else{ $id2seq{$id} .= $_; } } foreach $id (keys %id2seq){ open my $out_fh, '>>', $id or die $!; ##Amendment here print $out_fh ($id."\n",$id2seq{$id}, "\n"); close $out_fh; ## moved into the foreach loop } close File;
  • Comment on Re^2: I'm trying to print the contents of a hash to newly created files
  • Download Code