From: Pit Capitain Date: 2007-08-24T15:23:08+09:00 Subject: Re: Selecting indices from an array 2007/8/23, Ronald Fischer : > > > > a.enum_for(:each_with_index).inject([]){|res, i| > > i[0].match( /g$/) ? res << i[1] : res > > } > > This is an idea I like! Thanks a lot! And you can make it even easier to read: a.enum_for(:each_with_index).inject([]){|res, (elem, idx)| elem.match( /g$/) ? res << idx : res } Regards, Pit