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")
In reply to Re: remove single blank lines?
by graff
in thread remove single blank lines?
by aloomens
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |