in reply to character from middle

Modifying your code like so seems to work.

while(<DATA>){ s/(.+)\+(.+)/$1$2/g; print $_; }
A better way could be the one mentioned in the above post.

Replies are listed 'Best First'.
Re^2: character from middle
by Utilitarian (Vicar) on Sep 01, 2009 at 09:35 UTC
    Consider the data
    __DATA__ + 5 + 23 + 223 + 34 + 45 +
    Your solution will remove the last instance of "+" ie.
    + 5 + 23 + 223 + 34 45 +
    Depends on the expected data and required result, the presence of the /g operator made me suspect that the above data was likely