in reply to One more problem
in thread While loop printing only one fasta header file

I cannot understand this sentence:
if (($head =~ /$_/) .. ($_ =~ /\/\//))
What are you doing here?

In fact, the most sensible way to do your job is to load the FASTA sequence file into a hash:
my %fasta_source; my $tmp_title; open INSEQ,"<$file_fasta"; while (<INSEQ>) { chomp; if ($_=~/^>/) { $tmp_title=$_; } else { $fasta_source{$tmp_title}.=$_; } } close INSEQ;
This should put the FASTA file into the hash "fasta_source", and you would easy to do what you want.