title: using perl to create a simple calculator
body: <p>I need to design a simple calculator in Perl called ex1.pl with only <code>+</code>, <code>-</code>, <code>*</code>, and <code>/</code> functions. Below is what I have.</p>
  
  <pre><code>while (@ARGV&gt;0) {
      if ($_=~m/(\d+)\s(.)\s(\d+)/) {
          if ($2 == "+") {
              print "$1 + $3\n";
          }   
          elsif ($2 == "-") {
              print "$1 - $3\n";
          }   
          elsif ($2 == "*") {
              print "$1 * $3\n";
          }   
          elsif ($2 == "/") {
              if ($3 == 0 ) { 
                  print "$1 cannot be divided by 0\n";
              }   
              else {
                  print "$1 / $3\n";
              }   
          }   
          else {
              print "operator not identified\n";
          }
      }   
      else {
          print "syntax error\n";
      }   
  }
  </code></pre>
  
  <p>For example, if I type <code>./ex1.pl 5 + 2</code>, It keeps reporting errors that</p>
  
  <pre>
  Use of uninitialized value in pattern match (m//) at line 4
  </pre>
  
  <p>until I press ctrl + c.  Can anyone help me identify where I did wrong??</p>