title: perl script to recursively list all filename in directory
body: <p>I have written following perl script but problem is its always going in else part and reporting not a file. I do have files in the directory which I am giving in input. What am I doing wrong here?</p>
  
  <p>My requirement is to recursively visit every file in a directory, open it and read it in a string. But the first part of the logic is failing.</p>
  
  <pre><code>#!/usr/bin/perl -w
  use strict;
  use warnings;
  use File::Find;
  
  my (@dir) = @ARGV;
  find(\&amp;process_file,@dir);
  
  sub process_file {
      #print $File::Find::name."\n";
      my $filename = $File::Find::name;
      if( -f $filename) {
          print " This is a file :$filename \n";
      } else {
          print " This is not file :$filename \n";
      }
  }
  </code></pre>