my $c_per_line = 5; print "$1\n" while ($string =~ /(.{0,$c_per_line})/sg);