while () #this is my opened file { { next if /^\s*File/; #remove line starting with filename ($id, $seq) = split; push @{$species{$id}}, (split //, $seq); } #### while (($key, $sequence)=each %species) { print $key,$sequence; print "\n"; }