From: William James Date: 2007-08-25T00:50:04+09:00 Subject: Re: Selecting indices from an array On Aug 23, 8:08 am, "Ronald Fischer" wrote: > > If this is a > > problem, you can use this: > > > 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! > > Ronald > -- > Ronald Fischer > Phone: +49-89-452133-162 accum = [] a.each_with_index{|s,i| accum << i if s =~ /g$/ }