bert: 8 cookie: 11 elmo: 4 ernie: 8 zoe: 7Then read it in:
1: people = Array.new 2: 3: File.foreach("ages") { |l| 4: people << Person.new($1, $2) if l =~ /(.*):\s+(\d+)/ 5: } 6: 7: people 8: # -> [bert (8), cookie (11), elmo (4), ernie (8), zoe (7)]Back