in reply to Breaking the lines

A regular exression? I can't think of a way.

You mean a substitution. Only the fist half of a substitution is a regular expression.

It's not that hard.

my $l_max = 30; $str =~ s/(.{0,$l_max}) /$1\n/g;
Mind you, Text::Wrap does a far better job than this simple substitution. I'm not recommending to use it instead.

Anno