From: Robert Klemme Date: 2008-08-01T22:15:15+09:00 Subject: Re: Using array.select with grep 2008/8/1 Milo Thurston : > Before anyone asks, I'm not using the array intersecttion (arr1 & arr2) > because I am testing this expression prior to using it to find objects > in an array (arr1) where an object parameter is found in an array of > strings (arr2), e.g. to find all people from the array of people objects > whose first name is in a list of names: > > arr1.select { |y| arr2.grep(y.string_of_interest) } > > Although if there's a better way of doing that I'd be interested to > know. Just one additional remark: if your Arrays grow large you might benefit from converting them to Set which has faster lookups. Kind regards robert -- use.inject do |as, often| as.you_can - without end