title: How to use bash's grep in perl?
body: <p>I would like to run the following unix command in perl:</p>
  <pre><code>grep -r &quot;some_word&quot; /path/to/directory | wc -l
  </code></pre>
  <p>(The goal is to see how many times does &quot;some_word&quot; appear in a directory and all its inside-folders/files.</p>
  <p>What is Perl's equvalence?
  I tried looking <a href="https://metacpan.org/dist/PerlPowerTools/view/bin/grep" rel="nofollow noreferrer">here</a>, but not enough examples for what I need.</p>
  <p>For example, this is what I have:</p>
  <pre><code>/tmp/a/text1:
  &quot;This is a big text&quot;
  
  /tmp/a/text2:
  &quot;This is another text&quot;
  
  /tmp/b/text3:
  &quot;One more big text&quot;
  
  /tmp/a/a2/text4:
  &quot;Last big text&quot;
  </code></pre>
  <p>and I would like to be able to run the grep command and I shall get:</p>
  <pre><code>grep_command_in_perl -r &quot;big&quot; /tmp/ | wc -l
  3
  </code></pre>
  <p>Thanks! :)</p>
  <p>*** EDIT: ***
  (I don't understand why the question was closed... What kind of expectation was expected from me? Is &quot;grep -r &quot;some_word&quot; /path/to/directory | wc -l&quot; not enough to understand what I'm asking?</p>