in reply to Grep 1st word of strings in array

I looked at your code, deleted the comments and with an adjustment of whitespace we have this:
my @seqnames; my @sequences; foreach $line(@DNA) { if ($line =~ /^>/) { push(@seqnames, $line); } else { push(@sequences, $line); } }
Its hard for me to see how both arrays could wind up being "blank" (no entries).

Perhaps this is what you want, but I'm not sure:

my @seqnames; foreach $line(@DNA) { if ($line =~ /^>(\w+)\s/) { push(@seqnames, $1); } }