From: Jeff Date: 2008-07-07T23:59:43+09:00 Subject: Re: Find matching elements in array On Jul 7, 1:04 am, "Pragash Mr." wrote: > Hi, > I have one array for example[1,2,3,4] > > i need to find the matching elements of another array is there any way > to find.... > for example [1,2,3,4].include?(2) > it will return true > but i need to find one or more elements > example : [1,2,3,4].include?(2,3) > it is throwing an error > > If you have solution reply me > > Thanx > Pragash > -- > Posted viahttp://www.ruby-forum.com/. How about something like this? a = [1,2,3,4] x = [2,3] x.all? { |n| a.include?(n) } (warning, this is slow for large arrays) Jeff