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


in reply to Regex copy and paste help

This brings back nice memories, because it closely resembles the problem I solved as part of my first paying Perl gig, and that led to a contract that lasted about three years, back in about 1998.

As has already been explained, just collect the lines, putting each line into an array (I would use an array of arrays, or AoA). You could merge the continuation lines as you go, or you could do it at the end -- if a line has a '-' in the second column, replace that with whatever's in the next line's second column.

I also had to deal with headers and footers, but they were easier.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds