On Sat, 21 Jun 2003 11:39:20 +0000, Shashank Date wrote:

> 
> "Shashank Date" <sdate / everestkc.net> wrote in message
>> f = File.open("testfile","r")
>> while(!f.eof)
>>     s = f.gets
>>     puts s
>>     f.gets
>> end
>> f.close
> 
> Two one-liners (again ignoring exception handling, of course):
> 
> File.open("junk.txt","r") {|f| (puts f.gets; f.gets) while !f.eof}
> 
> File.readlines("junk.txt").each_with_index{|line,i| puts line if (i % 2 ==
> 0)}


file = __FILE__
ok = true
res = IO.readlines(file).reject { |obj| ok = !ok }
p res 


--
Simon Strandgaard