Something like:
foreach (keys %hash1) {
next if $hash1{$_} eq $hash2{$_};
print "$hash1{$_} $hash2{$_}\n";
}
On Wednesday, October 16, 2002, at 08:54 AM, Egleton, Gary wrote:
> Hi,
>
> 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
>
> Thanks very much,
>
> Regards, Gary
>
>
> ------------------------------------------------------------
> The information contained in or attached to this email is
> intended only for the use of the individual or entity to
> which it is addressed. If you are not the intended
> recipient, or a person responsible for delivering it to the
> intended recipient, you are not authorised to and must not
> disclose, copy, distribute, or retain this message or any
> part of it. It may contain information which is confidential
> and/or covered by legal professional or other privilege (or
> other rules or laws with similar effect in jurisdictions
> outside England and Wales).
>
> The views expressed in this email are not necessarily the
> views of Centrica plc, and the company, its directors,
> officers or employees make no representation or accept any
> liability for its accuracy or completeness unless expressly
> stated to the contrary.
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]