title: How can I use File::Find to print files with the relative path only?
body: <p>I am using <a href="http://perldoc.perl.org/File/Find.html" rel="nofollow noreferrer">File::Find</a> in the code below to find the files from <code>/home/user/data</code> path.</p>
  
  <pre><code>use File::Find;
  
  my $path = "/home/user/data";
  chdir($path);
  my @files;
  
  find(\&amp;d, "$path");
  
  foreach my $file (@files) {
  print "$file\n";
  }
  
  sub d {
  -f and -r and push  @files, $File::Find::name;
  }
  </code></pre>
  
  <p>As I am changing the dir path to the path from where i need to search the files but still it gives me the files with full path. i.e.</p>
  
  <pre><code>/home/user/data/dir1/file1
  /home/user/data/dir2/file2
  and so on...
  </code></pre>
  
  <p>but I want the output like</p>
  
  <pre><code>dir1/file1
  dir2/file2
  and so on...
  </code></pre>
  
  <p>Can anyone please suggest me the code to find the files and display from current working directory only?</p>