in reply to Re: How do I change substitution options within a program?
in thread How can I change substitution options within a program?

Better:

eval "\$source =~ s/\$find/\$replace/$opt";

Even better:

$opt =~ /[^imsx]/ and die(...); eval "\$source =~ s/\$find/\$replace/$opt";