#!/usr/bin/perl

$string="abcdefghijklmnopqrstuvwxyz";
$insert="\e[1K\e[10D";
$max=5;

while (length($string) > $max) {
    $res .= substr($string, 0, $max).$insert;
    $string = substr($string, $max);
}
$res .= $string.$insert;
print "$res\n";