in reply to How to remove middle of string?

This was covered fairly well in a node about extracting a range.

this node

Update: changed from an absolute link, thanks broquaint

Replies are listed 'Best First'.
Re: Re: How to remove middle of string?
by Anonymous Monk on Jun 06, 2002 at 14:10 UTC
    Thanks, but I actually am trying to replace the specified text with Different text
      The four-argument usage of perlfunc:substr will do what you are looking for. For example:

      my $string = "foo bar baz"; my $replacement = "moo"; # This will print "foo moo baz" print substr($string, 4, 3, $replacement), "\n";