The first example of Ruby File Access, "File.open("/usr/local/widgets/data").each { ..." shouldn't be used because the File is opened but never closed. A better idiom for files is to use IO::foreach:
IO.foreach("filename.txt") { |line| puts line }
Log in to post a comment.