The following works:
use strict; use warnings; my @phrases=('(arf)71', 'p65(91)', 'H:223', 'Phospholipase A2 inhibito +r', 'Phospholipase A2', 'Phospholipase', 'PLI-A', 'PLI-B', 'PLI'); my $string = join '|', map { quotemeta } @phrases; my $in = "(arf)71 p65(91) H:223 Phospholipase A2 inhibitor ( PLI ) , p +urified from the blood plasma of the Habu snake ( Trimeresurus flavov +iridis ) , was separated into two distinct subunits , PLI-A and PLI-B +"; my $out = "#(arf)71# #p65(91)# #H:223# #Phospholipase A2 inhibitor# ( +#PLI# ) , purified from the blood plasma of the Habu snake ( Trimeres +urus flavoviridis ) , was separated into two distinct subunits , #PLI +-A# and #PLI-B#"; #while($in =~ s/(^|\s)($string)(\s|$)/$1#$2#$3/) {}; while($in =~ s/(^|\s)($string)(\s|$)/$1#$2#$3/g) { pos() = pos() - 1; +}; print "success!!\n" if($in eq $out); print "in: $in\n"; print "out: $out\n";
In reply to Re^3: map function use
by ig
in thread map function use
by newbio
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |