c:\@Work\Perl\monks>perl -wMstrict -le "use 5.010; ;; my $s = '1,12,123,1234,12345,123456,1234567,12345678,123456789,1234567890'; $s x= 11; ;; my $max_cols = 29; my $max = $max_cols - 1; ;; $s =~ s{ \G .{1,$max} , \K } {\n}xmsg; print ' 1 2 3 4'; print '1234567890123456789012345678901234567890'; print $s; " 1 2 3 4 1234567890123456789012345678901234567890 1,12,123,1234,12345,123456, 1234567,12345678,123456789, 12345678901,12,123,1234, 12345,123456,1234567, 12345678,123456789, 12345678901,12,123,1234, 12345,123456,1234567, 12345678,123456789, 12345678901,12,123,1234, 12345,123456,1234567, 12345678,123456789, 12345678901,12,123,1234, 12345,123456,1234567, 12345678,123456789, 12345678901,12,123,1234, 12345,123456,1234567, 12345678,123456789, 12345678901,12,123,1234, 12345,123456,1234567, 12345678,123456789, 12345678901,12,123,1234, 12345,123456,1234567, 12345678,123456789, 12345678901,12,123,1234, 12345,123456,1234567, 12345678,123456789, 12345678901,12,123,1234, 12345,123456,1234567, 12345678,123456789, 12345678901,12,123,1234, 12345,123456,1234567, 12345678,123456789, 1234567890