johnfl68 has asked for the wisdom of the Perl Monks concerning the following question:
Hello:
I have sets of messages in strings, that are anywhere from 8 lines (LF at the end of each line) to about 50 lines.
I need to split them into chunks of 14 lines.
I know I can split the individual lines into an array using the line feed "\n" to do this, then scalar the array to find out how many lines, and then build back into a string of 14 for each block.
@descriptarray = split("\n",$description);Is there a shorter way to do the split at every 14th line feed?
Thanks as always!
John
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Split string after 14 Line Feeds?
by LanX (Saint) on Dec 04, 2012 at 00:35 UTC | |
Re: Split string after 14 Line Feeds?
by johngg (Canon) on Dec 03, 2012 at 23:47 UTC | |
Re: Split string after 14 Line Feeds? (//g)
by tye (Sage) on Dec 03, 2012 at 23:17 UTC | |
by johnfl68 (Scribe) on Dec 04, 2012 at 05:11 UTC | |
by tye (Sage) on Dec 04, 2012 at 05:24 UTC | |
by johnfl68 (Scribe) on Dec 04, 2012 at 07:41 UTC | |
Re: Split string after 14 Line Feeds?
by AnomalousMonk (Archbishop) on Dec 04, 2012 at 09:27 UTC | |
Re: Split string after 14 Line Feeds?
by Cody Fendant (Hermit) on Dec 04, 2012 at 11:30 UTC |
Back to
Seekers of Perl Wisdom