From: timr Date: 2008-08-22T16:16:23+09:00 Subject: Re: want to compare data in two files. To identify duplicates the 'array1 & array2' solution given above is perfect. See examples below: # setting up two arrays with your names irb(main):004:0> sheet1 = %w[vipul john mac smith nick] => ["vipul", "john", "mac", "smith", "nick"] irb(main):005:0> sheet2 = %w[anthony wayne bill randy thalia trishi ricky sachin nick] => ["anthony", "wayne", "bill", "randy", "thalia", "trishi", "ricky", "sachin", "nick"] # finding common elements, note the order is inconsequential irb(main):006:0> sheet2 & sheet1 => ["nick"] irb(main):007:0> sheet1 & sheet2 => ["nick"] # Determining what items are unique to the first array. (What items are in the first list that are not in the second?) Note order matters here. irb(main):008:0> sheet2 - sheet1 => ["anthony", "wayne", "bill", "randy", "thalia", "trishi", "ricky", "sachin"] irb(main):009:0> sheet1-sheet2 => ["vipul", "john", "mac", "smith"] irb(main):010:0> -Tim