(from Patrick's solution--for those who missed it)

     while (line = gets) do
       # I am a ruby newbie, and I could
       # not get gets to get the \r\n pairs
       # no matter how I set $/ - any pointers?
       ...

James Edward Gray II