$/ = '='; while () { s/\n\n=/\n=/m; print; } __DATA__ line 1 ====== line after break line