On 20 Aug 2007, at 14:50, Robert Klemme wrote:

>>
>> require 'set'
>>
>> new_ary = ary.to_set.to_a #set strips dups.
>
> It does, but as far as I can see OP wanted exactly the duplicates  
> back.
>
> Cheers
>
> robert
>


I'm a n00b, sorry if I'm poking nose in. Couldn't the op do something  
using &, like so:

[1,2,3] & [2,3,4]  == [2,3]


?

Regards Gabe