Ludo wrote: >if I understand what you want, maybe this could help you: >f.readlines[0].chomp! > > -KhiGia- > You might also find it a useful habit to pair any readlines call with a chomp mapped across the entire array. contents = IO.readlines(filename).map {|line| line.chomp} also note - when using readlines as a class method, there's no need to open and close the file. > >On Fri, 06 Dec 2002 12:13:26 +0100, Basti S wrote: > > > >>Hi there, >>i have a little problem. I want to read out lines of a file. But every time >>ruby reads it out, there is always this \n at the end of the line. Does >>anybody know how to get rid of this character? >> >>Example: >> >>f=File.open("123") >>f.readlines[0] >> >>for example returns the first line: 12345\n >> >>If you don't know what I mean, feel free to write me. I don't know how to >>express it correctly... >> >>Thanks >> >> > > >