The only issue with using a var as the pattern (other than your missing =~ or course) is that it MAY contain regex metachars. quotemeta and its RE friends \Q and \E are your friends. Do:
$foo =~ s/\Q$find\$E/$replace/g;
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Regex with variables?
by tachyon
in thread Regex with variables?
by Quadzilla
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |