CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [Fred] Strange behavior of variable in substitution expression: Edit Log



Laurent_R
Veteran / Moderator

Aug 20, 2012, 10:32 AM


Views: 7690
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)


Edit Log:
Post edited by Laurent_R (Veteran) on Aug 20, 2012, 10:34 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives