in reply to How to split a string based on the length of a sequence of characters within the string

Note that you may also use the substr function in a while loop.

It is probably faster than a regex or a split, but unpack is likely to be the fastest solution (if speed matters in your case). This is a link to a post where I used several different methods to solve your exact problem and to a benchmark on those various methods I did some time ago: Re: Performance problems on splitting long strings.

Replies are listed 'Best First'.
Re^2: How to split a string based on character(s) length
by thanos1983 (Parson) on Aug 13, 2014 at 20:26 UTC

    Hello Laurent_R,

    Thanks a lot for the link. In my case time is not an issue but I ques when files while start to grow, the time will start to be an important factor. Again thank you for your time and effort it is really nice that people offer advice on such a small issues that are easy to understand. At least for beginners like me.

    Seeking for Perl wisdom...on the process of learning...not there...yet!
      Hi thanos1983,

      You are welcome, it is my pleasure to help you if I can. Even if speed is not your concern (it was for me, having to deal with very large files, several GB), the post I linked to offers 8 different solutions to your problem (3 of which, at least, perhaps more, were suggested by other monks in previous posts of the same thread, you can look at the history of the thread if you want to know; well, in brief, they are not "my" solutions, but solutions derived from a very fruitful discussion with many monks), you may find some interesting ideas from them.