in reply to FASTA Splitter

my ($sequence) = $chunk =~ /([a|c|t|g]+)\s+/;
Well, I think you are confusing the syntax of character classes and alternation. The stuff in the brackets is a set, so you don't use the OR character also.

I think your problem is that although you read the whole thing as one record (splitting at the '>'), you forgot that there are still newlines in the string. So, you'll match the first line only, (as I recall, \n is considered whitespace).

Also you are looking for lower-case and the file contains upper case.

If you're trying to parse out each big block as you showed it, here's what I'd do: Forget the record-separator stuff. I never touch it, and most people don't.

Read the first line (loop and try again if the line is blank). Use the split function to separate it at the '|' chars.

Read lines until you hit a blank line. Those are the big block of data.

Write it out in the new format.