in reply to Re: How to remove middle of string?
in thread How to remove middle of string?

Thanks, but I actually am trying to replace the specified text with Different text
  • Comment on Re: Re: How to remove middle of string?

Replies are listed 'Best First'.
Re: Re: Re: How to remove middle of string?
by rob_au (Abbot) on Jun 06, 2002 at 23:39 UTC
    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";