title: Bitwise comparision of two directories(files) in Perl
body: <p>I am trying to achieve the follwing using perl</p>
  
  <p>A script that performs bitwise comparison of files from two directories
  (the directory names are passed as arguments to the script in the command line).
  The script should read all files from the first directory and all subdirectories, and
  compare them to the corresponding files (e.g. files with the same names) in the
  second directory.</p>
  
  <p>The result of the script - (PASSED or FAILED) is formed according to:
  The result is FAILED when at least one file from the first directory is not bitwise
  equal to the corresponding file in the second directory or the second directory
  has no corresponding file.
  Otherwise test is PASSED.</p>
  
  <p>So far I have tried the approach in this thread created by me - <a href="https://stackoverflow.com/questions/9477905/comparing-two-directories-using-perl/9480331#9480331">Comparing two directories using Perl</a> . After some point I realized I am essentially trying to do simulate "diff -r dir1 dir2" which isn't the goal, How can one perform bitwise comparision operation on two directories?</p>
  
  <pre><code>EDIT: Test Case
  
    /dir1                       /dir2
         -- file1                   -- file1 
         -- file2                   -- file2  
         -- file3 
         -- ....
         -- ...
         ---/subDir1
              --file1
              --file2
  
  file1 of dir1 contains :- foo bar
  file1  of dir2 contains :- foo 
  Result - Fail
  
  file1  of dir1 contains :- foo bar
  file1  of dir2 contains :- foo bar
  Result - Pass.
  </code></pre>
  
  <p>The script should essentially extract files with same names present in different directories.</p>