Please excuse my newbieness, second day with Ruby.

textlist = ["Apple", "Orange", "Lemon", "Grape", "Orange", 
"Melon","Orange", "Banana"]

i = textlist.index("Orange")

if !i.nil?
        puts "textlist[" << i.to_s << "] is \"" << textlist[i] << "\""
  j = textlist[i+1,textlist.length-i-1].index("Orange")+i+1
        if !j.nil?
          puts "textlist[" << j.to_s << "] is \"" << textlist[j] << "\""
        end
end


outputs:


textlist[1] is "Orange"
textlist[4] is "Orange"
-- 
Posted via http://www.ruby-forum.com/.