From: James Dechiaro Date: 2008-05-13T22:33:50+09:00 Subject: Re: array diff if SumArray.include?(row[1])did the trick...thanks adam! Adam Shelly wrote: > On 5/12/08, James Dechiaro wrote: >> the problem i'm running into is when i try to open back the csv1 and >> compare the SumArray against it in order to get the entire line (not >> just the element). It instead prints all the lines, even the ones not >> contained in the array. >> >> So it looks as though the .eql? module is not working correctly. >> > There are a few potential problems with this line: > records.collect do |row| row[1].eql?(SumArray) > > First, I think you need an 'if'. Otherwise you are calling eql? but > not using the result. Second, it looks like you are comparing a > single field with the > whole SumArray. They will never be equal. You probably want something > like > if SumArray.include?(row[1]) > > -Adam -- Posted via http://www.ruby-forum.com/.