Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^3: Bitwise comparision of files

by Limbic~Region (Chancellor)
on Feb 28, 2012 at 18:27 UTC ( #956723=note: print w/replies, xml ) Need Help??

in reply to Re^2: Bitwise comparision of files
in thread Bitwise comparision of files

Based on this explanation, you are going to want to take a look at File::Find. There are other modules on CPAN that try to make up for the horrendous call-back interface but the point is - don't try and walk the directory structure yourself - you will make a mistake.

You are also going to want to take a look at File::Spec. There are a bunch of functions that will help you say things like chop off this portion of the path and replace it with this other path in order to determine if the file even exists in the other directory prior to comparing the actual file contents.

You probably also want to take a look at Digest::MD5. It isn't a great choice for cryptographical reasons but in order to determine if two files are or are not the same, it has a really simple interface and should work just fine.

If you want more help than that, you are going to have to show some more effort first.

Cheers - L~R

Replies are listed 'Best First'.
Re^4: Bitwise comparision of files
by kelly (Initiate) on Feb 28, 2012 at 18:47 UTC
    Thanks a lot guys, i will pursue the headsup . Basically my intention is not to simulate diff -r in Perl, rather the contents of the file bit-by-bit. Thanks once again.

      But that's what 'diff -r' does: compares the contents of two directory structures and reports any differences between the files, or files in one structure that are missing in the other. If you just want to know what files are different, without seeing the lines on which they are different, add the '-q' or '--brief' option.

      Aaron B.
      My Woefully Neglected Blog, where I occasionally mention Perl.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://956723]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2018-05-24 01:05 GMT
Find Nodes?
    Voting Booth?