in reply to parsing question

If you want to do bioinformatics with Perl, may I recommend getting familiar with Bioperl (http://bioperl.org/). It provides modules for FASTA format parsing (and many other formats. Your homework is then very easy :)
use Bio::SeqIO; $in = Bio::SeqIO->new(-file => "inputfilename",-format => 'Fasta'); while ( my $seq = $in->next_seq() ) { $seqstr = $seq->seq(); # actual sequence as a string print $seqobj->display_id(); # human readable id of the sequence print length($seqstr); # length of sequence }
Code is untested and largely lifted from the Bioperl tutorial.