http://www.perlmonks.org?node_id=1199683


in reply to Splitting a file based on matched conditions

skumar_pm:

You could just read the file in as a single string, then break it into chunks with regular expressions. Then examine the chunks to decide which array you want to put them.

Alternatively, you could change the input record delimiter to '\nStart:' and read them a chunk at a time, then again, examine each chunk to decide where to put them.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: Splitting a file based on matched conditions