Normally, regex matches don't overlap. Here's one article that explains how to solve it with a
lookahead assertion: http://linuxshellaccount.blogspot.com/2008/09/finding-overlapping-matches-using-perls.html
my $string = "123perl456perl789perl10";
while ($string=~m/(.{2}perl(?=(.{2})))/gp)
{ print "$1$2\n" }