Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Split string after 14 Line Feeds?by johnfl68 (Scribe) |
on Dec 03, 2012 at 23:05 UTC ( [id://1006961]=perlquestion: print w/replies, xml ) | Need Help?? |
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
Back to
Seekers of Perl Wisdom
|
|