but this only works if each hash has the same keys. if one hash might have more/less keys than the other use this:
my %seen; foreach ( grep !$seen{$_}++, (keys %hash1, keys %hash2) ) { next if $hash1{$_} eq $hash2{$_}; print "key: $_ - hash1: $hash1{$_} - hash2: $hash2{$_}\n"; # now prints extra keys not in both hashes } > -----Original Message----- > From: James Edward Gray II [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 16, 2002 11:25 AM > To: Egleton, Gary > Cc: [EMAIL PROTECTED] > Subject: Re: comparing two hashes > > > Something like: > > foreach (keys %hash1) { > next if $hash1{$_} eq $hash2{$_}; > print "$hash1{$_} $hash2{$_}\n"; > } > ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]