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.
In reply to Re: Grep 1st word of strings in array
by tobyink
in thread Grep 1st word of strings in array
by imtakinbioinformatic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |