in reply to how to compare two hashes with perl?

You might take a look at Data::Compare on CPAN.

Your code would reduce to the following Perlish pseudo-code:

/usr/bin/perl use strict; use warnings; use Data::Compare; # Note: you probably will have to install this from + CPAN # Load the first hash (bow1) # Load the second hash (bow2) # Now the magic -- my $rc = compare(\%bow1, \%bow2); if ($rc) { print "Equality\n"); } else { print ("The hashes are not equal\n"); } exit(0);
(Coded but not tested. Your compilation may vary....)

Look at the Synopsis of the Data::Compare module for examples of usage.

----
I Go Back to Sleep, Now.

OGB

Replies are listed 'Best First'.
Re^2: how to compare two hashes with perl?
by FluffyBunny (Acolyte) on Nov 04, 2009 at 21:12 UTC
    my two files might not be in order... and I'm only checking with my first column and 5th column. I'm not sure if the program is applicable for me