thanks to all replies. your all codes working well. some codes 
impressing me to know more of Ruby. Can you explain this code in order 
to understand?

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