Excellent explanation of three functions that anyone doing biological research in Perl should know. :)
You should also check out using the BioPerl modules for doing your sequence input and output, it will make your program general enough to work with many different sequence formats, not just FASTA. Here's a quick example:
use Bio::SeqIO;
my $filename = 'test.seq';
my $format = 'fasta';
my $seqio = Bio::SeqIO->new( -file => $filename, -format => $format );
while ( my $seqobj = $seqio->next_seq() ) {
my $raw_sequence = $seqobj->seq;
# do your searching on this raw sequence
}
Hope this helps. :)