Reverse the string, reverse the pattern, do the substitue, reverse the
string again.
the string is "I am the titi last human on titi earth."
the pattern is /titi/
so reverse the string (with reverse in a scalar context):
.htrae itit no namuh tsal itit eht ma I
reverse the pattern /itit/
do the substitute
reverse the string again to make it normal again.
<code>
#!/usr/bin/perl -w
use strict;
my $str = "I am the titi last human on titi earth.";
my $rev = reverse $str;
$rev =~ s/itit//;
$str = reverse $rev;
print "$str\n";
</code>
On 28 Jun 2001 16:58:03 +0200, St�phane JEAN BAPTISTE wrote:
>
>
> Hi
>
> I want to delete a string but only the last.
> Example/
>
>
> I am the titi last human on titi earth.
>
>
> -> I want to erase the last "titi" nut not the other.
>
> How can I do this
>
> thanks
>
--
Today is Prickle-Prickle, the 33rd day of Confusion in the YOLD 3167
Or is it?