my $string = 'one two three two four'; my $search = 'two '; substr($string, rindex($string,$search), length $search, ''); print $string;