Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: comparing two sets of data

by marquezc329 (Scribe)
on Nov 28, 2012 at 08:12 UTC ( #1005976=note: print w/replies, xml ) Need Help??

in reply to comparing two sets of data

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2018-05-21 06:13 GMT
Find Nodes?
    Voting Booth?