title: Perl if-statements / regular expressions
body: <p>I'm not entirely sure why my if-statements are not validating user input. Here's my code.
  The statements that contain regular expressions are supposed to allow leading, and trailing white space.</p>
  
  <pre><code>sub     Menu
  {
  
      &amp;processlist;
      &amp;creating_Refs;
  
      print "[Sort by COLUMN|sortup|sortdown| quit]:";
      my $user_input = &lt;STDIN&gt;;
      chomp($user_input);
  
      if($user_input =~ m/[quit\s]/)
      {
              exit;
      }
      elsif($user_input eq 'sortup')
      {
              print "working bro\n\n";
              @$VAR1 = sort sortup @$VAR1;
  
              foreach my $ref (@$VAR1)
              {
                      print "$ref-&gt;{PID}, $ref-&gt;{USER}, $ref-&gt;{PR}, $ref-&gt;{NI}, $ref-&gt;{VIRT}, $ref-&gt;{RES}, $ref-&gt;{SHR}, $ref-&gt;{S}, $ref-&gt;{CPU}, $ref-&gt;{MEM}, $ref-&gt;{TIME}, $ref-&gt;{COMMAND} \n";
              }
      }
      elsif($user_input eq 'sortdown \n')
      {
              print "working on sortdown\n\n";
  
      }
      elsif($user_input =~ m/[sort by]+\w/)
      {
  
  
      }
      else
      {
              print "Error, please re-enter command \n\n";
              &amp;Menu;
      }
  </code></pre>
  
  <p>}</p>