in reply to Find common substrings

Fletch has given you a nice hint to get you started.

Please understand that Perl Monks is not a code writing service. Quoting from Gramps' reply to one of many similar recent questions:

I know you are hoping that we might just write the whole thing for you, but you should at least show some effort. Meet us part way by showing a first attempt at solving the problem with comments indicating where you can't figure stuff out.

See also: How do I post a question effectively?