Julius Plenz wrote: > * hu8 <jakobfastenbauer196 / hotmail.com> [2005-01-30]: > ^^^ > You should post with a real name here. > > >>How can I read data from a file? How to separate it, is my >>second question. > > > begin > file = File.open('filename') > while not file.eof? > values = file.gets.split(/,/) > # do some stuff with it > end > ensure > file.close > end You might do better to leave the hard work to ruby: IO.readlines( 'filename' ).each{ |line| ary_values = line.split(/,/) # do some stuff with it } By using the block form you let Ruby handle the check for EOF and close the file when done. James