in reply to Regex Question : Substitution
Just replace
$eng =~ s/u/a/i) if ($eng =~ /^.*u.*/g);by
$eng =~ s/u/a/ig;There is no need to test whether the substitution will work, just do it.
I think you wanted to write initially was more:
$eng =~ s/u/a/i while ($eng =~ /^.*u.*/g);but even if this works it is really inneficient. To start with the /^.*u.*/ is strictly equivalent to /u/ except that it is slower (you should read Death to Dot Star! for more on the evils of .*)
|
|---|