http://www.perlmonks.org?node_id=111621

artist has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
Anyone has easy idea as how to find patterns in a given string where only number of patterns are known? One pattern can appear any number of times in the string. String contains nothing but patterns. Number of patterns is always more than 1.
ex. string: helloworldhellohellohihellohiworld
    number of patterns:3
    ========================================
    Deduce patterns:hello, world, hi

Edit: chipmunk 2001-09-10