Shashank Date wrote:

> But, when "test1.txt" is a big file (say 4MB) it takes for ever to read the
> file.

I hope this isn't a big step-out on my part, but ISTR that there is 
known problem with file I/O in Ruby 1.6.6 for Windows. You should check 
the mailing list or newsgroup archives for more information. It is also 
my understanding that this problem has been fixed in Ruby 1.7.2. So if 
you're running under Windows this would explain the significant time 
differences that others are seeing when running under Ruby 1.6 on Unix.