in reply to Substitution with multiple options for capture and replace.
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Substitution with multiple options for capture and replace.
by elmuel (Initiate) on Nov 10, 2009 at 19:21 UTC |