From: sto.mar@... Date: 2013-01-13T06:21:18+09:00 Subject: Re: How to take information from a text file and add them to an array Am 12.01.2013 20:08, schrieb Joel Pearson: > Just to take this a bit further and give you a practical demonstration, > although you might want to look into encrypting the passwords as well > for safer storage... > > Assuming the input is an already-validated tab-delimited file with > "username\tpassword" as the format: > > users_passwords = Hash.new > temparray = File.read('input.txt').split(/\n/).map! { |line| > line.split("\t") } > temparray.each { |ar| users_passwords[ar[0]] = ar[1] } or: users_passwords = Hash[temparray] > p users_passwords --