use CSV alongside the File class
require 'csv' people = CSV.parse(File.read('text.txt')) puts people[0][0] puts people[1][0] puts people[2][0] //File: text.txt F,M,M,45 L,C,F,23 D,P,F,38