Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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;


Comment on Re: Trying to split a file into array conditionally
Download Code
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-08-22 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (145 votes), past polls