Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Trying to split a file into array conditionally

by bart (Canon)
on Nov 15, 2011 at 12:04 UTC ( #938152=note: print w/replies, xml ) Need Help??


in reply to Trying to split a file into array conditionally

Perhaps you could only split where the next line doesn't start with an opening square bracket?

split takes a regex, thus this is fairly easy.

@info = split /\n(?!\[)/, $filecontents;

Replies are listed 'Best First'.
Re^2: Trying to split a file into array conditionally
by bobg2011 (Novice) on Nov 16, 2011 at 09:42 UTC
    Thanks guys...... I've gone with brats solution.... it does the trick nicely! cheers! :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2016-12-03 22:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (60 votes). Check out past polls.