Maybe there is a function, which can find every (maximal by length) equal substring of string1 and string2 in perl, isn't it?
I can find every substring in string, using m/substring/g;
.
For searching all equal substrings, I must shift the pointer of string1's begin and symbol-by-simbol compare strings. How can I do it in perl, or is there a way easer? (the ready function)
Thank you in advance.
my $string1 = "... (i==i)kn;i=n.n;k(i(i,"%i",&i);i ...";
my $string2 = "... k;kn;i=n.n;k;k(i(i,"%i",&i);k ...";
my @answer = ( ..., "kn;i=n.n;", "k(i(i,"%i",&i);", ... );
Your example seems to show returning two different lengths of substring, with the shorter one first, so I'm not sure what "maximal by length" means. But this may help:
output:
Tree::Suffix was kind of a pain to install; I had to delete the included inc/Devel/CheckLib.pm because it had errors and install Devel::CheckLib separately, as well as downloading and installing the libstree library.