or, to avoid modifying $str and be rid of trailing spaces
my $tmp = $str; $tmp =~ s/((?:\s*\d+){20})/$1\n/g; print OUT "$tmp\n";
update: get rid of leading spaces
my $tmp = $str; $tmp =~ s/\s*((?:\s*\d+){20})/$1\n/g; print OUT "$tmp\n";
In reply to Re^2: printing 20 characters in a line.
by ig
in thread printing 20 characters in a line.
by heidi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |