title: Executing grep via Perl
body: <p>I am new to Perl. I am trying to execute grep command with perl. </p>
  
  <p>I have to read input from a file and based on the input, the grep has to be executed.</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>#!/usr/bin/perl
  use warnings;
  use strict;
  
  #Reading input files line by line
  open FILE, "input.txt" or die $!;
  my $lineno = 1;
  while (&lt;FILE&gt;) {
  
          print " $_";
          #This is what expected.
          #our $result=`grep -r Unable Satheesh  &gt; out.txt`;
          our $result=`grep -r $_ Satheesh  &gt; out.txt`;
          print $result
  
  }
  print "************************************************************\n";
  </code></pre>
  
  <p>But, if I run the script, it looks like a infinite loop and script is keep on waiting and nothing is printed in the out.txt file.</p>