use strict; use warnings; use Data::Dumper; local $/=">"; while(my $fasta_record=){ chomp $fasta_record; $fasta_record =~ s/(^>*.+\n)/$1: /; #add a space after the fasta header $fasta_record =~ s/\n//g; # remove endlines print $fasta_record,"\n"; } __DATA__ >protein1 WWWWTCTG TTWTTTCT TTWWWC >protein2 WWWWTCTG TTWWWC TTWTTTCT >protein3 TTWWWC WWWWTCTG TTWTTTCT #### use strict; use warnings; use Bio::SeqIO; #initialize a bioperl object instance my $in = Bio::SeqIO->new(-file=> "database_filename.fa", -format=>"fasta"); while(my $seq = $in->next_seq){ #read the sequences in the bioperl object print $seq->id," ",$seq->seq; #output,ID space-separated from sequences print "\n"; } ####