This is a very specific question (which I doubt most will be able to benefit from) but I'll explain:
I have an example file which contains numbers split by commas on each line:
1,2,3,4
5,6,7,8
abcdefg
1.3.4
I want to be able to split the file into lines (easily done):
file = File.open(filename)
file = file.read.split("\n")
And now I want to split each line into an array if it includes "," and have the name or the array be something like: 1array (with 1 being the file line index)
Something like this would be preferable:
file.each_with_index |c, i| do # c=content, i=index
if c.include? ","
instance_array_set("@#{i}array", c.split(","))
end
end
I've looked everywhere for anything on an instance array concept but I can't seem to find anything. I am open to completely different ways of doing what I'm trying to do (as long as it's not too long).
Thanks in advance (hopefully)