path="test.txt" port=open(path) begin port.each_line{|line| p line.to_s } ensure port.close end STDOUT << "i love you " port=open('test.txt') s=port.stat p s.ftype p s.dev p s.ino p s.mode p s.nlink begin a=port.readlines a=port.each{|e| p e} ensure port.close end