my $phrases_pat = join '|', map quotemeta, @phrases; $in =~ s/(?<!\S)($phrases_pat)(?!\S)/#$1#/g;
Bonus: In addition to being much simpler, this should be faster since much less work is outside the substitution, in matching and in replacing.
In reply to Re^4: map function use
by ikegami
in thread map function use
by newbio
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |