title: Perl finding a file based off it's extension through all subdirectories
body: <p>I have a segment of code that is working that finds all of the .txt files in a given directory, but I can't get it to look in the subdirectories. </p>
  
  <p>I need my script to do two things</p>
  
  <ol>
  <li>scan through a folder and all of its subdirectories for a text file</li>
  <li>print out just the last segments of its path</li>
  </ol>
  
  <p>For example, I have a directory structed</p>
  
  <pre><code>C:\abc\def\ghi\jkl\mnop.txt
  </code></pre>
  
  <p>I script that points to the path <code>C:\abc\def\</code>. It then goes through each of the subfolders and finds <code>mnop.txt</code> and any other text file that is in that folder.</p>
  
  <p>It then prints out <code>ghi\jkl\mnop.txt</code></p>
  
  <p>I am using this, but it really only prints out the file name and if the file is currently in that directory. </p>
  
  <pre><code>opendir(Dir, $location) or die "Failure Will Robertson!";
  @reports = grep(/\.txt$/,readdir(Dir));
  foreach $reports(@reports)
  {
      my $files = "$location/$reports";
      open (res,$files) or die "could not open $files";
      print "$files\n";
  }
  </code></pre>