in reply to remove single blank lines?

No one else brought this up, so... How confident are you that all of your blank lines will consist of just "\n"?

If an input file has been created manually, the odds are close to 50-50 that at least some "blank" lines contain spaces and/or tabs as well as the terminating newline (LF, CR or CRLF, depending on your OS). In this case, you may be better off using one of the line-oriented approaches (rather than a "slurp" approach), and using the regex conditional (/^\s*$/) instead of ($_ eq "\n")