You can also read an entire file into an array, split by lines : Read lines together « File Directory « Ruby






You can also read an entire file into an array, split by lines

puts File.open("text.txt").readlines.join("--")

 

Related examples in the same category

1.File.readlines
2.Counting Characters