http://qs1969.pair.com?node_id=105338


in reply to Comparing contents of 2 Hashes of Hashes

I'm assuming that the code you posted is a little stripped down from the real thing, because as written %localdigest and %remotedigest are guaranteed to be identical (you assign $digest to each hash one after the other without modifying $digest in between.)

Anyway, assuming the hashes are actually different, this ought to work:

foreach $clusterhost(@hosts) { foreach $file(@files) { if ($localdigest{$clusterhost}{$file} ne $remotedigest{$cluster +host}{$file}) { $error=1; print "The local $file on $clusterhost does not equal t +he remote $file.\n"; } } } if (!$error) { print "All files matched on all hosts.\n"; }

Gary Blackburn
Trained Killer

Replies are listed 'Best First'.
Re: Re: Comparing contents of 2 Hashes of Hashes
by Tuna (Friar) on Aug 16, 2001 at 15:52 UTC
    Yes, way trimmed down! First, the code will populate HoH1 with locally generated config files. Once they are distributed to their respective hosts, we will calculate checksums after the transfer, populate HoH2, and compare.