in reply to reading files in directory
Don't reinvent the wheel.
Perl seems to be the language of choice in the biological sciences, especially genetics. I don't know if you've seen it, but make sure you've checked out the many well thought out solutions available at the BioPerl site. In particular, I found a reference to the FASTA format.