title: Perl Regular expression match from user input
body: <p>I'm just learning perl and I'm trying to learn regular expressions at the same time. Basically I'm trying to open a log file and print out any lines that match user input to a new file. Using the following code I get no output at all if I type in the word "Clinton". But if I replace</p>
  
  <pre><code>print MYFILE if /\$string\;
  </code></pre>
  
  <p>with</p>
  
  <pre><code>print MYFILE if /\Clinton\; 
  </code></pre>
  
  <p>it runs as expected. Any ideas? I know it is something simple that I am missing.</p>
  
  <pre><code>print "Enter a word to look up: ";
  $string = &lt;&gt;;
  print "You put $string";
  open(LOG,"u_ex121011.log") or die "Unable to open logfile:$!\n";
  open (MYFILE, '&gt;&gt;data2.txt');
  while(&lt;LOG&gt;){   
     print MYFILE if /\Q($string)\E/;
  }
  close (MYFILE); 
  close(LOG);
  print "Check data2.txt";
  </code></pre>