From: pustoi@... (Arthur Korneyew) Date: 2004-10-10T00:44:50+09:00 Subject: split file into 2D array Hello, I have file like this (words.txt): # word1 word2 word3 word4 word5 word6 word7 word8 How can I split words into 2D array in ruby ? I just tried: a = [[],[]] IO.foreach("words.txt") {|line| unless line.strip.empty? | (line =~ (/^\#/)) string = line.chomp.split a << string end } #puts a puts [0][1] [root@tequila2 logs]# ./logs5.rb nil If I tried to print second element from array (it should be word2),I have got nil. Thank you in advance