SyntaxFix
Write A Post
Hire A Developer
Questions
One simple method is to use readlines:
readlines
my_array = IO.readlines('filename.txt')
Each line in the input file will be an entry in the array. The method handles opening and closing the file for you.