in reply to Help with Regexp substitution using variables
The following works, but you risk injecting commands into your script. To do it properly, you'd have to do the variable interpolation yourself.
my ($reg, $reg2) = @ARGV; my $string = "how1=on&how2=on"; $string =~ s/$reg/ eval "\"$reg2\"" /eg; print $string;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help with Regexp substitution using variables
by Roy Johnson (Monsignor) on Jan 20, 2005 at 17:41 UTC | |
by ikegami (Patriarch) on Jan 20, 2005 at 19:26 UTC |