|Syntactic Confectionery Delight|
Could you give us more information about what processing you are going to do?
The reason for these questions is that whether done in Perl or C allocating the memory in which to build the list of positions is a substantial part of the overall cost. If you only need each position in isolation, then an iterator interface might be more efficient to use.
Equally, are the pairs of strings you are comparing the same length? Or are you comparing short strings with (every?) substring of a large strings? Are you comparing many short strings against (every) substring of larger strings?
The problem is that the basic mechanics of comparing the characters in two string is very fast. Especially in C. But the details of the code that surrounds that can have a big impact on the overall application time.
Rather than an extended to'n'fro of questions, it would be easier if you posted code or pseudo-code of the actual application, along with numbers and sizes of the strings involved.
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.