From: Vincent Fourmond Date: 2006-11-15T18:48:14+09:00 Subject: Re: [File -> Lines -> Chars] Logic issue (open) Flaab Mrlinux wrote: > Hi there > > Just a simple question from a newbie =) > > I have a file that can have N lines. Those lines are string of > characters, and each character is a sign of a combination i have to > store, but at the same time i have to be able to treat each sign of each > combination separately, in order to compare them and all. > > For instance: > > # Combination file > > 11XX22X1XX12X23 > XX12XX122X212X2 > XX2X11XX11XX111 > > My program has to return and array for each line, and that array should > have stored in it each sign of the line. > > My question is...how can i Read EACH line of the file, explode each char > of the array and store it? > > Thx. > ary = File.open(file).readlines.map {|l| l.chomp.split // } -- Vincent Fourmond, PhD student http://vincent.fourmond.neuf.fr/