title: Checking to see if any .txt files exist in a directory using a Perl script
body: <p>I have a directory, <em>/home/textfile/</em>.</p>
  <p>I want to use a Perl script to check to see if *.txt file exist in this directory or not.  If they do, I want to have it say &quot;Text files exist&quot;.  Otherwise, if there are no text files in the directory I want it to say &quot;No text files exist&quot;.</p>
  <p>The text files could have any name. I just want to check if there is a text file in that directory, <em>/home/textfile</em>.</p>
  <p>Below is the script I am trying to use:</p>
  <pre><code>$filedir = &quot;/home/textfile/&quot;;
  chdir($filedir);
  if (-e &quot;`ls *.txt`&quot;)
  {
      print STDOUT &quot;Text file exist&quot;
  }
  else
  {
      print STDOUT &quot;No text file exist&quot;
  }
  </code></pre>
  <p>How can I fix this script so it will do what I am looking for it to do?</p>