might use (untested):
$string = reverse($string);
$string =~ s/owt //;
$string = reverse($string);
Thus spake the Master Programmer:
"When you have learned to snatch the error code from the trap frame, it will be time for you to leave."
--
The Tao of Programming