|Syntactic Confectionery Delight|
Compare Values in HoHby AcidHawk (Vicar)
|on Apr 06, 2006 at 08:38 UTC||Need Help??|
AcidHawk has asked for the
wisdom of the Perl Monks concerning the following question:
Hi, I have 2 csv files, File1 look as follows
1141286452,ServerA,Disk Full,Arb data,other,stuff
and File2 like so
I read them into 2 seperate hashes. (In the example code I have just hardcoded the hashes.) Firstly, I need each line of the file to appear in the hash, and none of the fields contain UNIQUE data, hence the index (or KEY of Ahash and Bhash) I create ie (1,2,3 etc which relates to line numbers). The real data is held in the value of Ahash and Bhash as another hash. Looking at the example code may help with the explanation.
What I want to do is check if a VALUE in Ahash is also in Bhash (or a line in File1 is also in File2). So here is what I have that works on small hashes...
This does not scale well as you can see that each value in Ahash is checked agains each value in Bhash. Is there a better way to compare values in hashes that are hashes?
Of all the things I've lost in my life, its my mind I miss the most.