in reply to Identifying Overlapping Area in a Set of Strings

Unfortunately I can't help you. Especially since I'm not really sure to have understood what your problem really is. Only, at first sight, it seems to me you're using quite a lot of arrayrefs where -unless I'm missing something obvious- a real array could be used instead. Any particular reason for this? Just curious...

More on topic, to identify overlapping regions of strings you may consider using the bitwise operators e.g. $str1^$str2 will give you a sequence of null chars where $str1 and $str2 overlap.

PS: one thing I don't understand is that you refer to "its set of substrings" but in the explicit examples you give it doesn't seem that @$nsub is the set of all substrings of the given string. Also you emphasize that you want to identify overlapping regions of "subsequent" strings, which suggests that order does matter, so that my guess is that you really have "a list of substrings of a given string". Is this more close to the point?

Replies are listed 'Best First'.
Re^2: Identifying Overlapping Area in a Set of Strings
by monkfan (Curate) on Jul 29, 2005 at 09:10 UTC
    Hi,
    it doesn't seem that @$nsub is the set of all substrings of the given string.
    Yes you are right. They may or may not be the complete set of substrings.
    which suggests that order does matter, so that my guess is that you really have "a list of substrings of a given string".
    Again you are right!. They are already "ordered", that's why the set is an array.
    Regards,
    Edward
      Incidentally this is why the computer-theoretic concept of array is not the most appropriate correspondent of the mathematical concept of set.