Whitey has asked for the wisdom of the Perl Monks concerning the following question:

I need to remove any and all instances of the following string.. What is the command to do so? <TR><TD>&amp;nbsp;</TD></TR>

Replies are listed 'Best First'.
Re: I need to remove all instances of a particular string.
by dvergin (Monsignor) on Aug 03, 2001 at 02:58 UTC
    $somestring =~ s#<TR><TD>&amp;nbsp;</TD></TR>##g; You might want to do some reading up on regexes: perlman:perlre.

    Update: Oops! Brain swapped out. Slashes in the regex don't mix well with slashes as delimiters. I substituted #'s for a more felicitous result. Thanks buckaduck and runrig...  

    dvergin considers reading perlman:perlre himself.

      Um, those '/' characters are going to cause you trouble, you could use a different s/// delimiter, but probably better just to use quotemeta on the string first:
      my $qmstring = quotemeta('<TR>...etc.'); $somestring =~ s/$qmstring//g;