i think you did not understand my question here.

For an example,

sheet

name   age  class
raj    21   first
gopal  22   second

now,

 Now sheet is the array but the element in the array is hash.

sheet.each do |element|
   if element['name']='gopal'
        return element
   end
end

so my aim is to get the record which consist of the name gopal. Now I am 
using loop for this as i have written, my question is, can able to 
access that element without loop?do you know any predefined function for 
that?

Another question, we can use the key to find the element in the hash, 
but do we find the key using value? one of the way is,

raja.each do |key,value|
if value=='hi'
return key
end
end
Is there any other way ? Is there any predefined function?

RAJ

-- 
Posted via http://www.ruby-forum.com/.