in reply to Extracting IDs from fasta file
Help With FASTA
In addition to the many useful responses you've received, one source of wisdom for Bioinformatics + Perl is the BioPerl Site, which you may not previously have been exposed to. I highly recommend you begin your search for a solution there. A quick search revealed a BioPerl page devoted just to FASTA, which will in turn lead you to the many Bio-Perl-Monks who have already developed solutions for just your problem.
In Section
Seekers of Perl Wisdom