in reply to regexp question

Alternatively, you could use the word boundary marker

/(.{1,20})\b/g

In contrast to using \s*, this would prevent individual words from being split across lines, which I guess was the idea behind the space you used...

Replies are listed 'Best First'.
Re^2: regexp question
by tfoertsch (Beadle) on Dec 29, 2006 at 11:55 UTC
    This does what I wanted:
    my @x=/(\S.{0,19})(?=\s|$)/g;

    Thanks to all