my $s = "xabcdefghijXABCDEFGHIJ01234567890"; while ($s =~ /(......)(.....)/g) { print "$1 $2\n"; }