#!/usr/bin/perl
use strict;
use warnings;
my @found;
# 0 1 2 3 4 5
# 012345678901234567890123456789012345678901234567890
$_ = q'abczdefzabcghijklzabczaerabrtyuabcethdauthabkudiabc';
# abc abc abc abc abc
# 0 8 18 31 48
m<
(
(?{
push @found, pos()
})
abc # the string I know which repeats
)
\G
.+?
\1
>gx;
print join ', ', @found, "\n";
####
m<
(
(?{
push @found, pos()
})
[a-z]{3} # suppose i'm looking for a series of 3 repeating characters...
)
\G
.+?
\1
>gx;
####
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
####
$,=42;for(34,0,-3,9,-11,11,-17,7,-5){$*.=pack'c'=>$,+=$_}for(reverse split//=>$*
){$%++?$ %%2?push@C,$_,$":push@c,$_,$":(push@C,$_,$")&&push@c,$"}$C[$#C]=$/;($#C
>$#c)?($ c=\@C)&&($ C=\@c):($ c=\@c)&&($C=\@C);$%=$|;for(@$c){print$_^$$C[$%++]}