From: Gavin Sinclair Date: 2003-09-18T17:01:14+09:00 Subject: Re: Why IO#readlines does'nt accept a Regexp? On Thursday, September 18, 2003, 5:53:20 PM, gabriele wrote: > as in the subject, I just noticed that readlines just accepts a string > as line Separator, and I wonder why it works this way. > Some explanations? Sorry, none from me ;) > BTW, if I want to read a file in a array of 'words' I have to do : > File.new('myfile').gets(nil).split > no better way ? File.read('myfile').split > on a sidenote, what are the efficiency issue related to the use of > IO#each vs IO#foreach(anIO) vs a simple 'while line=gets..' ? All of these read the file one line at a time and present that line to the user. It's hard to imagine any performance difference between them. Gavin