in reply to Re: How do I delete the last instance of a word from a string?
in thread How do I delete the last instance of a word from a string?

danger pointed out that this removes the last char of the string if word is not found... if that is an issue use the following...
my $ri = rindex($string,$word); substr($string,$ri,length($word)) = '' if $ri > -1;

                - Ant
                - Some of my best work - (1 2 3)

  • Comment on Re: Answer: How do I delete the last instance of a word from a string?
  • Download Code