To my eye the regex reads better if you start the memory group with a set of digits (thus removing the worry about leading spaces) and then follow with grouped spaces and digits with a quantifier of 0 to 19. That avoids the adjacent \s* tokens which might be a little confusing at first glance. Also, you don't need the parentheses around the match.
print qq{$1\n} while $str =~ m{(\d+(?:\s+\d+){0,19})}g;
I hope this is of interest.
Cheers,
JohnGG
In reply to Re^2: printing 20 characters in a line.
by johngg
in thread printing 20 characters in a line.
by heidi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |