Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Comparing contents of 2 Hashes of Hashes

by Trimbach (Curate)
on Aug 16, 2001 at 15:47 UTC ( [id://105338]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://105338]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 02:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found