From: Nuralanur@... Date: 2006-05-16T18:23:09+09:00 Subject: In search of elegant indices searching -------------------------------1147771382 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Dear all, I have a Hash, with equal-length Arrays as values, something like my_hash={'x',[1,1,3,1,5,6],'w',[1,2,3,1,4,5],'y',[1,1,1,4,4,6],'z',[0,1,1,2,3, 4]} . Some of the values in the Arrays occur several times. Now, I am looking for an elegant way to extract, for all the values of specified keys, all the indices where one or more variables do not change their values, i.e., something like class Hash def fixed_vars(which_vars) # some elegant code return result end end res=my_hash.fixed_vars(['x','w']) giving res={{'x'=>1,'w'=>1}=>[0,3],{'x'=>3,'w'=>3}=>[2],{'x'=>5,'w'=>4}=>[4],{'x'=>6, 'w'=>5}=>[5]}. How could that be done? Thank you! Best regards, Axel -------------------------------1147771382--