http://www.perlmonks.org?node_id=1206966
beecha has asked for the wisdom of the Perl Monks concerning the following question:

HI All,

happy new year

i am reading text file which contains below multiple lines.

i am reading every line one by one as a string. if the line is started with WAR i need to check for '{' and make all the line into a single line till it ends with '}' without considering the '&' character

EX:

war eligible, init =0*DEC0, ev (VARIABLE){1*BIN0,2*DEC3,6*BIN4, & 5*BIN43,6*DEC32, & 5*BIN43,7*DEC32}

CONVERTED TO:

war eligible, init =0*DEC0, ev (VARIABLE){1*BIN0,2*DEC3,6*BIN4,5*BIN43 +,6*DEC32, 5*BIN43,7*DEC32}
war wear, init =1*DEC1, ev (VARIABLE) { & 1*BIN0,2*DEC3,6*BIN4, & 5*BIN43,6*DEC32, & 5*BIN43,7*DEC32,6*DEC32,6*DEC3, & 8*BIN3,6*DEC34 }

CONVERTED TO:

war wear, init =1*DEC1, ev (VARIABLE) { 1*BIN0,2*DEC3,6*BIN4, 5*BIN43, +6*DEC32, 5*BIN43,7*DEC32,6*DEC32,6*DEC3, 8*BIN3,6*DEC34 }

please help me with this how to convert.

2018-01-09 Athanasius added code and paragraph tags