I know you are answering the question exactly but this is not the best approach for a couple of reasons. First, this is not actually parsing the FASTA record. Second, there is a more idiomatic way to read a file into a scalar with:
my $var = do { local $/; <$fh> };
where $var holds your file however, I would not do this with sequence data. It's best to set the record separator and read line by line and not store the data (unless necessary), but that was not part of the question.
Thank you, guys. You've all been very helpful with your tips and examples. I'm going to sit down later and try to put this all together. I think I have a much better idea of what I need to do now. Hopefully I can do it!
That's the spirit!