To replace a substring in a string in Perl, you can use the `s///` substitution operator or the `replace()` function.
In this example,
$str
with a value of "Hello World"
.s///
substitution operator to replace the substring "World"
with "Universe"
.$str
.$str = "Hello World";
$str =~ s/World/Universe/;
print $str;
Hello Universe
In this tutorial, we learned How to Replace a Substring in String in Perl language with well detailed examples.