Regular Expressions
Pattern Matching

  • Perl enables you to compare a regular expression pattern against a target string in order to test for a possible match

  • The outcome of the test is a boolean result (TRUE or FALSE)

  • The boolean test may be used in any conditional statement

  • The basic syntax of a pattern match is

      $myScalar =~ /PATTERN/

  • You can read this statement as

      "Does $myScalar contain PATTERN ?"