in reply to Re: A Little String Help Please
in thread A Little String Help Please
The part generation code can be condensed a little through use of a regex:
use strict; use warnings; my $n = shift; my $text = do {local $/; <DATA>}; $text =~ s/\n/ /g; my @lines = $text =~ /(.{1,$n})\s+/g; print "$_\n" for @lines; __DATA__
which generates the same output given the same input as the sample above.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: A Little String Help Please
by johngg (Canon) on May 06, 2007 at 22:58 UTC |