in reply to printing 20 characters in a line.
Yet another option using regular expression:
while ($str =~ /((\s*\d+){1,20})/g) { print OUT "$1\n"; }
update: get rid of leading spaces
while ($str =~ /\s*((\s*\d+){1,20})/g) { print "$1\n"; }
update2: which you can do as a one-liner
print "$1\n" while ($str =~ /\s*((\s*\d+){1,20})/g);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: printing 20 characters in a line.
by johngg (Canon) on Nov 14, 2008 at 14:44 UTC |