From: Mark Thomas Date: 2009-04-27T22:10:04+09:00 Subject: Re: How to parse a "line"? On Apr 27, 8:50 am, Martin Sharon wrote: > :)I am really confused with ruby now. > OK, what I want to do is this, let me describe by c > > input is one line: number city1 city2....city2 > > for(i=0;i { >    function(cityi) > > } Is that all you want to do? Once you have the cities, cities.each do |city| function(city) end So, putting it all together, lines.each do |line| (cities = line.split).shift cities.each do |city| function(city) end end You don't really need the number at all. -- Mark.