title: Why am I having trouble comparing lines from input in Perl?
body: <p>I don't know what I could be doing wrong with this simple transaction, but it's not working:</p>
  
  <pre><code>print "OK? (y or n)\n";
  $ans = &lt;&gt;;
  print "\n";
  if($ans eq "y"){print $ans;}
  </code></pre>
  
  <p>I basically want to know how to test the user input.  This little bit of code won't work for me.  I'm just trying to print <code>$ans</code> if <code>y</code> is entered by the user.</p>
  
  <p>Any suggestions?</p>
  
  <p>EDIT: - I have also tried single quotes</p>