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.
In reply to Re: Can I Use Variables In A Regex?
by pg
in thread Can I Use Variables In A Regex?
by Khatri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |