Hello mimiandi,
While I agree that your OP needs clarification and supplemental code, here is a simple method using grep to gather keys that differ.
#!/usr/bin/perl
use strict;
use warnings;
my %file1 = ( samp1 => 'stuff',
samp2 => 'data',
samp3 => 'info',
samp4 => 'foo',
samp5 => 'bar',
blah => 'blah',
brood => 'other' );
my %file2 = ( samp1 => 'stuff',
samp2 => 'diff',
samp3 => 'blah',
samp4 => 'foo',
junk => 'stuff',
trash => 'other',
samp5 => 'bar' );
my (@diff1, @diff2);
push @diff1, grep !$file2{$_}, keys %file1;
push @diff2, grep !$file1{$_}, keys %file2;
Depending on the complexity of your data, you may want to have a look at Data::Compare. I believe Test::More also offers some tools for comparing data structures.
Post some code or at least some sample input data and I'm sure you'll rope some better answers.
Suggested Reading: How (Not) To Ask A Question
|