in reply to Re: Regex Grumblings (Variable Interpolation)
in thread Regex Grumblings (Variable Interpolation)
All you get is: `ls` I wasn't hoping for a miracle to occur, just that $foo would be translated as literal string '$bar', and that the '$' would be recognized as just another ASCII character, not the end of line anchor. After all, if we're on the subject of evil, now this means that you can put all sorts of wacky stuff in your variable and it gets interpolated as regexp material, or at least jostles your program with a warning:my $foo = "`ls`"; # "Evil" command my $bar = "$foo"; print $bar,"\n";
Maybe there should be a switch for regexps which cause any interpolated strings to be interpreted as just text and any meaning is disregarded. Of course, you can always do this with \Q and \E...my $foo = '(?{die})'; s/$foo/XYZ/g; # Eval-group not allowed at runtime, use re 'eval'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^2: Regex Grumblings (Variable Interpolation)
by chipmunk (Parson) on May 23, 2001 at 23:22 UTC |