in reply to Counting characters in a string
my $c_per_line = 5; print "$1\n" while ($string =~ /(.{0,$c_per_line})/sg); [download]