http://qs321.pair.com?node_id=11102837

vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I want to compare two .mdb(Microsoft access files), to find are there any changes done on the files, for that I just wrote the below function.

sub compare { my $pre_version =shift; my $new_version =shift; print("previous version: $pre_version\n"); print("new version : $new_version\n"); my $pre = Digest::MD5->new; open (PRE, "$pre_version"); $pre->addfile(*PRE); close(PRE); my $pre_digest = $pre->hexdigest; #print "pre digest=$pre_digest\n"; my $new = Digest::MD5->new; open (NEW, "$new_version"); $new->addfile(*NEW); close(NEW); my $new_digest = $new->hexdigest; #print "new digest=$new_digest\n"; if ($pre_digest eq $new_digest) { print("Equal\n"); return 0; } else { print("Not Equal\n"); return 1; } }
Update: Variable names modified.

Even thought there are no changes between two MDB files I am always getting "Not Equal".

pre_version of the MDB file downloaded from git and new_version was a local copy. before pushing to the git repository I want to make sure there are some difference. If the are no difference I need to block the push.


All is well. I learn by answering your questions...