in reply to spliting text!!
use strict; use warnings; my $line = <DATA>; # Quick and dirty # Greedily match anything from 1-70 characters my @lines = $line =~ /.{1,70}/g; print $_,"\n" for @lines; # Less memory use for large blocks of text while ($line =~ /(.{1,70})/g) { print $1,"\n"; } __DATA__ 1234567890123456789012345678901234567890123456789012345678901234567890 +123456789012345678901234567890123456789012345678901234567890123456789 +012345678901234567890123456789012345678901234567890123456789012345678 +901234567890123456789012345678901234567890123456789012345678901234567 +890123456789012345678901
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: spliting text!!
by duff (Parson) on Mar 08, 2007 at 19:29 UTC | |
by eric256 (Parson) on Mar 08, 2007 at 21:44 UTC | |
by chrism01 (Friar) on Mar 08, 2007 at 23:00 UTC | |
by eric256 (Parson) on Mar 08, 2007 at 23:12 UTC |
In Section
Seekers of Perl Wisdom