Or for searching for strings (this does not work for patterns) you can use rindex:
my $string = 'one two three two four'; my $search = 'two '; substr($string, rindex($string,$search), length $search, ''); print $string;
-- Hofmator
In reply to Re: Substitute _last_ occurence in string?
by Hofmator
in thread Substitute _last_ occurence in string?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |