in reply to Re: How to split a string based on length or word boundary
in thread How to split a string based on length or word boundary
Brilliant++!
Just needs a couple of tweaks:
print "| $_ |\n" for map substr($_ . ' ' x 16, 0, 16), $s =~ m[(.{1,16 +})(?:\s+|$)]g; # ^^ + ^^^^^^^^^
(Otherwise, the final word won’t be printed unless it happens to be followed by whitespace.)
Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How to split a string based on length or word boundary
by BrowserUk (Patriarch) on Dec 21, 2012 at 03:04 UTC |
In Section
Seekers of Perl Wisdom