To remove a specific character from a string in Perl, you can use the `s///` substitution operator.
In this example,
$str
with a value of "Hello World"
.s///
substitution operator to replace all occurrences of 'l' with an empty string in $str
.s///
operator modifies the string in place.$str
.$str = "Hello World";
$str =~ s/l//g;
print "Modified string: $str\n";
Modified string: Heo Word
In this example,
$str
with a value of "apple"
.s///
substitution operator to replace all occurrences of 'a' with an empty string in $str
.s///
operator modifies the string in place.$str
.$str = "apple";
$str =~ s/a//g;
print "Modified string: $str\n";
Modified string: pple
In this tutorial, we learned How to Remove specific Character from a String in Perl language with well detailed examples.