From: "Ara.T.Howard" Date: 2005-11-08T06:33:16+09:00 Subject: Re: from text file to array in shortest way ---1400102478-904261675-1131399194=:2231 Content-Type: MULTIPART/MIXED; BOUNDARY="-1400102478-904261675-1131399194=:2231" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1400102478-904261675-1131399194=:2231 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 8 Nov 2005, [ISO-8859-1] Simon Kr=F6ger wrote: > Ara.T.Howard wrote: >> On Tue, 8 Nov 2005, ngoc wrote: >>=20 >>> books_array =3D Array.new() >>> File.open('books_file.txt').each { |line| >>> books_array.push(line) >>> } >>>=20 >>> Are there other ways shorter than above ? >>> For example: books_array =3D File.open('books_file.txt').to_array() >>=20 >>=20 >> a =3D IO::read 'books_file.txt' >>=20 >> -a > > you just misspelled 'readlines', right? :) indeed. thanks. -a --=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | anything that contradicts experience and logic should be abandoned. | -- h.h. the 14th dalai lama =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D ---1400102478-904261675-1131399194=:2231-- ---1400102478-904261675-1131399194=:2231--