|go ahead... be a heretic|
Re: Compare 2 Hashes w/ Multiple Variablesby Laurent_R (Canon)
|on Dec 23, 2013 at 22:24 UTC||Need Help??|
OK, now you have added your code. What you are doing is far far too complicated. What you need to do is this:
- Read file1 and, for each line, find the name (the key) and the three metrics, and store in your hash something like this:
- Then, you read file2 line by line, split each line to find the name2 and mtric4. Once you have that, check is the name2 is an existing key of %hash1, and, if such is the case, just print the output with something like this:
No need for %hash2, no need to store the file in an array.
Also, I have not seen your input data, but this code:
could be replaced by something much simpler like this:
Finally, I would suggest that you use strict; and use warnings; near the top of your program and declare your variables with the my function.
Please provide a sample of your input data (file1 and file2) if you need further detailed help.