Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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]
[james28909]: well i have officially wore my brains out on hash refs and array refs and hash of arrays
[james28909]: push @{$hash{$ref}}, $this, $that, $the_other;
[james28909]: for 0 .. 3 {print $hash{$ref}}$_;
[james28909]: or i guess that is a hash ref

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2017-05-01 03:34 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (544 votes). Check out past polls.