Yes, index looks like a fine way to find the small string inside the big one. I don't know the rule for adding 'O' and 'I' to your string, but index tells you how many bytes from the front the small string is located, so given that value and your rule for adding 'I' and 'O', it should be straightforward. Don't forget that a simple way to generate a repeated string of characters is the x operator:
my $text = 'The quick red fox jumped over the lazy brown dog';
my $search = 'quick';
my $location = index($text, $search);
if ($location < 0) {
print "$search not found!\n";
}
else {
print "$search found $location bytes from the front" . ("!"x$locat
+ion), "\n";
}
(Note: totally untested)
...roboticus
When your only tool is a hammer, all problems look like your thumb.