title: Do both alternatives match when using | in Perl regular expressions?
body: <p>I am confused about the regular expression below. Please help me to understand it.</p>
  
  <pre><code>my $test = "fred andor berry";
  if ($test =~ /fred (and|or) berry/) {
      print "Matched!\n";
  } else {
        print "Did not match!\n";
  }
  </code></pre>
  
  <p>I thought it would match, but I get "Did not match!". If I add <code>+</code> in it, like this,</p>
  
  <pre><code>my $test = "fred andor berry";
  if ($test =~ /fred (and|or)+ berry/) {
     print "Matched!\n";
  } else {
     print "Did not match!\n";
  }
  </code></pre>
  
  <p>Then it matches. I thought I can use <code>and|or</code> to match an expression with "and", "or" and "andor". No? </p>