in reply to Re: How do I change substitution options within a program?
in thread How can I change substitution options within a program?
See perlop, namely qr/PATTERN/options. With qr// you can change imosx options as you wish within dynamically generated patterns.I read your comment as meaning you can set the regex options from variables when using qr//. However, none of the following work for me:
$mods = "im"; $test = qr/xyz/$mods; # Syntax error. $test = qr/xyz/"$mods"; # Ditto. $test = qr/xyz/\$mods; # Ditto. # ... out of ideas.
Could you clarify your post? What can you do with qr// and modifiers that you can't with m// or s///?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How do I change substitution options within a program?
by ikegami (Patriarch) on Oct 31, 2006 at 23:41 UTC |