david cateron wrote:

Subject: Search through two arrays for differences

This is explained in the FAQ:

perldoc -q "How do I compute the difference of two arrays"


I have put information in two arrays as follows:
Element(0) - File Name
Element(1) - Field Name
Both arrays are set up this way. I'd like to search through both arrays
and if the File name is the same in both (there will be about 10 different
file names--file names in the first array should also be in the second
array) and the field name is the same in both, ignore it. But if the file
name is the same in both and there's a difference in the field name, like
a field name that is not there, I'd like to output that difference.
So the first file might look like this:
FileA A
FileA B
FileA C
FileB A
FileB B
FileC a
And the second file like this:
FileA B
FileA C
FileB A
FileB a
FileC a
How can I do this taking into account the fact that I'm matching array
elements[0] in each file before checking to see if both files contain the
same fields? Essentially I'm looking for any missing fields between files.

It looks like you may need a more complex data structure than just arrays but it is hard to tell without seeing any actual code.

perldoc perldata
perldoc perldsc
perldoc perllol


John -- use Perl; program fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to