my %subst; @subst{@name} = ( 1 .. @name ); $phylo =~ s/(\w+)/$subst{$1}||$1/eg;
The || will break down if one of your replacement strings is '0'. Fortunately in this case it is not.
In reply to Re: Word matching in string
by nobull
in thread Word matching in string
by Jaya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |