Regular Expressions
The Substitute Operator

  • The substitution operator s may be applied to a target string using a variant of the pattern matching syntax

      $myString =~ s/SEARCH/REPLACE/;

  • The effect is that $myString will be modified if the SEARCH pattern matches

      $myString = "Bat";
      $myString =~ s/B/C/; # Yields "Cat"