Gary Egleton wrote: > > Hi, Hello,
> can any one point me at how to compare two hases. > > ie > > hash1 > 1 abc > 2 def > 3 ghi > > hash2 > 1 abc > 2 defzzz > 3 ghi > > I want to take the values for matching keys and see if they are the same if > not write out the value > > so in the above the values in 1 and 1 are ok, the values in 3 and 3 are ok > but in key 2 they do not match Probably something like this should work: for my $key ( keys %hash1 ) { if ( exists $hash2{$key} and $hash1{$key} ne $hash2{$key} ) { print "%hash1: $hash1{$key}\n"; print "%hash2: $hash2{$key}\n"; } } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]