
Laurent_R
Enthusiast
Aug 20, 2012, 10:32 AM
Views: 5186
|
|
Re: [Fred] Strange behavior of variable in substitution expression
|
|
|
The e flag enables evaluating the replacement string as a Perl expression. You can use both g and e in the same replacement: $foo =~ s/source/target/eg; An alternative to the ternary operator or the successive else or case statements would be to use a hash to find the replacement string from the user input.
(This post was edited by Laurent_R on Aug 20, 2012, 10:34 AM)
|