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;
In reply to Re: Help with Regexp substitution using variables
by ikegami
in thread Help with Regexp substitution using variables
by kwokna
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |