Avoid reinventing the wheels.
[Recommended] FASTA Splitter – A perl script that divides a large FASTA file into a set of smaller equally sized files. Written by Kirill Kryukov.
split_fasta from nash-bioinformatics-codelets
How to split a Multiple fasta on Biostar