Greetings all,
Update a better way to do it.(than I had previously posted)
Though only tested on a simple case the following should get you your global replace you were looking for.
$str =~ s/if substr\(([^\)]*)\) in (\([^\)]*\))/my($f,$s)=($1,$2); $f=
+~s!^!\$!; $s=~s!\D!!g; "if substr($f) =~ m#[$s]#"/eg;
yet another way to do it.
$str =~ s/in/=~/;
$str =~ s/(?:\s)(\([^\)]*\))/my $s=$1;$s=~s!\D!!g;" m#[$s]#"/e;
Which outputs
if substr(acct_trtmt_hsty,1,1) =~ m#[789]#;
from your original string.
-InjunJoel
"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo