|Just another Perl shrine|
I have 2 strings, with one being a substring of the other, like: $big_string=... & $small_string=... For the small string I have a label string: $label_for_small=... What I would like to do is to first identify the "small" substring into the "big" one, and then add, respectively, 'I's and 'O's (or the opposite) in the start and end positions.
Add Is & Os ... to what? The big string? The small string? The label string? A post-it on the back of your keyboard?
I'm thinking to use index, would this be efficient solution?
Yes. index locates strings within strings efficiently.
But your description of what you then want to do is about as clear as mud.
And how would I know how many 'O's and 'I's must I add in order for the "small" substring to grow into the length of the "big" one?
So you want to grow the small string to be the same length as the big one? If so, what is the label for?
Your label seems to contain the Is & Os you mention, but as the label is shirt than the big string, and you have mamy of each, they do not represent the start and end positions of the matched substring? And what are the Ms for?
Try asking your question again, this time imagine you are explaining it to someone with no knowledge of computers.
You might also like to give an example of (much shorter!) inputs and the required output(s).
A picture is worth a thousand words.
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.