How can I golf this Perl subroutine that does a substitution?
- by JoelFan
I have the following subroutine in Perl to substitute "abc" for "xyz" in a string:
sub mySubst {
my ($str) = @_;
$str =~ s|abc|xyz|ig;
return $str;
}
It works, but seems way too verbose for Perl. How can I tighten it up?