Hi, there is another solution:

File.open('pp.txt') do |infile|
  while line = infile.gets        #the loop ends if infile.gets == EOF
    line_split = line.split(" ")  #split line through spaces; return 
vector
    puts line_split[0]            #the first element of the line is the 
number
  end
end

for more information of this topic:

http://pleac.sourceforge.net/pleac_ruby/fileaccess.html
-- 
Posted via http://www.ruby-forum.com/.