Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Splitting a file based on matched conditions

by roboticus (Chancellor)
on Sep 19, 2017 at 15:56 UTC ( #1199683=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1199683]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2017-12-17 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (466 votes). Check out past polls.

    Notices?