You're on the right track. The global matching starts at the position where the last match ended. You can use
\G to mark the position, but you can't move it backwards. For overlapping matches, you need look around assertions:
my $string = '123perl456perl789perl10';
while ($string =~ /(?<=(..))perl(?=(..))/g) {
print "$1perl$2\n";
}
Where (?<=...) means "is immediately preceded by", and (?=..) stands for "is immediately followed by". The look around assertions are not part of capturing (that's why you need to add capturing parentheses into the assertions), and they don't affect the position of the match.
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
}map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,