Help for this page
while( $input =~ m{\G(?:.{$n})*?(?=fred(....))}g ) { pos($input) += $n; ... # do stuff with $1 # ... }
pos($input) += $n * int((length('fred'.$1) - 1) / $n + 1);