in reply to Can I Use Variables In A Regex?
As jZed said, had you tried, you would have found out yourself.
use Data::Dumper; use strict; use warnings; my $t = "abc"; my $b = "x"; my $l = "xyzabcdef"; $l =~ s/$t/$b/g; print $l;
This prints:
xyzxdef
Make it simple, obviously it works.
|
|---|