$string =~ s/(.*)\s*two/$1/; That way, you'll catch it if it's the first characters in the string.
Update: Ok. Given the suggestions, How about:
$string =~ s/(.*)(^|\s+)two/$1/;
In reply to Re: Re: Re: Substitute _last_ occurence in string?
by dragonchild
in thread Substitute _last_ occurence in string?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |