John Hennessy wrote:
>
> Hi, I have two different hashes built from separate data and need to
> find the common then differing items.
>
> $HoA1{$custnum} = [ $uid, $firstname, $lastname ];
> $HoA2{$uid} = [ $custnum, $firstname, $lastname ];
>
> I have looked at examples for "Finding Common or Different Keys in Two
> Hashes" but the keys must be the same.
> To make the keys the same I would like to effect a reverse function but
> only reversing the key and the first value leaving the remaining array
> items in place.
Hi John.
I would start by pulling out the lists of Customer Numbers and User IDs
from the two hashes like this:
my @custnum1 = keys %HoA1;
my @uid1 = map { $Hoa1{$_}[0] } @custnum1;
my @uid2 = keys %HoA1;
my @custnum2 = map { $Hoa1{$_}[0] } @uid2;
Then you only have the job of finding differences and commonalities
between @custnum1/@custnum2 and @uid1/@uid2.
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>