in reply to RE - match from right
$string =~ s/(.*)b/\1x/; [download]
I don't know if that would be faster or slower than reversing it first.
TheEnigma