|Perl Monk, Perl Meditation|
Identifying Overlapping Area in a Set of Stringsby monkfan (Curate)
|on Jul 29, 2005 at 08:48 UTC||Need Help??|
monkfan has asked for the
wisdom of the Perl Monks concerning the following question:
Given a full string ($fseq) and its set of substrings (@$nsub). And @$nsub always comes (extracted) from $fseq.Although they may or may not be the 'complete' substrings.
I wish to identify the overlapping region of the given set of substrings and replace them with '-' (as shown with $result variable - the intended result). To be precise, I want to remove the overlapping region of two subsequent strings in the set (@$nsub).
I really have no idea how can I approach this problem.
I have aligned manually the substring set (@$nsub) to show how they are overlapping, as well as the alignment of the desired result after removing the overlapping area. I hope the examples are clear.
Thanks so much beforehand.