title: Perl - Multiple condition if statement without duplicating code?
body: <p>This is a Perl program, run using a terminal (Windows Command Line). I am trying to create an &quot;if this and this is true, or this and this is true&quot; <em>if</em> statement using the same block of code for both conditions without having to repeat the code.</p>
  <pre><code>if ($name eq &quot;tom&quot; and $password eq &quot;123!&quot;) elsif ($name eq &quot;frank&quot; and $password eq &quot;321!&quot;) {
  
      print &quot;You have gained access.&quot;;
  }
  else {
  
      print &quot;Access denied!&quot;;
  }
  </code></pre>