in reply to perlkhan 77
Your code is full of mistakes/"sins". If you want to work with fasta files please take a look at fasta on CPAN. It might be a better idea to use an existing module to work with fasta files than to roll your own.
Some general comments:
- check for the success of open, don't assume everything is fine.
- use the the 3-arg form of open, see open.
- put use strict; and use warnings; in your code. It would catch most of the errors in your script.