I'm currently trying to figure out how to pass an index range as a string, but so far have not been having any luck. Here is an example of what I'm trying to do:
pos = %w{1 2..4}
values = %{x cat}
test_string = "This is a test with a string."
test_string[pos[1]] = values[1]
I know I could just break it down with split or something similar, but I would really like to know how to pass this value directly. I thought I could accomplish it with eval, but so far I have been having no luck. Any help would be greatly appreciated, thanks!