I have a variable that contains the following:
var1 = "01","02","03","04"
I want to put the contents of that variable into an array. I'm new to Ruby, so this is something I haven't tried before, and I don't know if it can be done. I tried:
a1 = Array.[](#{var1}) thinking that that would put the value into the parenthesis. This puts the entire variable value into the "0" element. I'm looking to put each of the numbers into their own element, which would leave me with an array with 4 elements, "01" through "04". Can anyone tell me what I'm doing incorrectly? Better yet, can anyone tell me how to do this correctly?
Thanks...
var1 = "01","02","03","04"
I want to put the contents of that variable into an array. I'm new to Ruby, so this is something I haven't tried before, and I don't know if it can be done. I tried:
a1 = Array.[](#{var1}) thinking that that would put the value into the parenthesis. This puts the entire variable value into the "0" element. I'm looking to put each of the numbers into their own element, which would leave me with an array with 4 elements, "01" through "04". Can anyone tell me what I'm doing incorrectly? Better yet, can anyone tell me how to do this correctly?
Thanks...