From: 7stud -- Date: 2007-10-27T08:39:51+09:00 Subject: Re: improperly exiting loop with DATA and __END__ Robert Keller wrote: > I have this bit of code that loops through the __END__ data and does > some time sheet processing. All that bit works, but when I get to the > end of the "DATA" I get an error about calling split for a > nil:NilClass...I an sure it is because I am trying to process the last > record which is an empty string. Not quite. After the last line of the file has been read, if you call gets() again, it returns nil. If your last line was really a blank line, you wouldn't get an error: line = "" processed_line = line.chomp.split(",") puts "--->#{processed_line}<----" output: ---><---- -- Posted via http://www.ruby-forum.com/.