in reply to Grep 1st word of strings in array

Something like:

my @firstwords = map { /^>(\w+)/ ? $1 : '#ERR#' } @segnames;

In the above, if the string doesn't start with /^>(\w+)/ then the string "#ERR#" is used as the first word.