while () { $_ .= ; s/^0\s*(.*)\n\s+(.*\n)/$1 $2/s; print; } #### { local $/ = undef; $_ = ; s/^0\s*(.*)\n\s+(.*\n)/$1 $2/s; print; }