To insert a character at a specific index in a string in Perl, you can use string interpolation or the `substr()` function.
In this example,
$str
with a value of "Hello World"
.'!'
at index 5
.$str
.$str = 'Hello World';
substr($str, 5, 0) = '!';
print $str;
Hello! World
In this tutorial, we learned How to Insert Character at Specific Index in String in Perl language with well detailed examples.