title: Use of uninitialized value $guess in numeric lt (<) line 25 in Perl
body: <p>I'm very new to Perl and have been given an assignment that is a simple guessing game where the user is given 8 chances to guess a number between 1 and 100. I keep getting the error mentioned above and cannot figure it out.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>    use Modern::Perl;
  
      my ($guess,$target,$counter); 
      $target = (int rand 100) + 1;
  
      while ($guess &lt; $target)
      {
          chomp ($guess=&lt;&gt;);
          print "Enter guess $counter: ";
  
          $counter++;
  
          if ($guess eq $target) {
              print "\nCongratulations! You guessed the secret number $target in   $counter";
          }
          elsif ($guess &gt; $target) {
              print "\nYour guess, $guess, is too high.";
          }
          elsif ($guess &lt; $target) {
              print "\nYour guess, $guess, is too low.";
          }
          else {
              print "You lose. The number was $target.";
          }
      }
  </code></pre>