The left side is the regex, the right side is perl variable interpolation, and if you use the /e flag, its perl code. so
More in perlretut, perlre$_ = "123"; s/(.)/ my $r = " LEFT "; if($1 eq '1'){ $r = " one " } $r /eg; print "$_\n"; __END__ one LEFT LEFT
In reply to Re: Substitution with multiple options for capture and replace.
by Anonymous Monk
in thread Substitution with multiple options for capture and replace.
by elmuel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |