in reply to How do I remove blank lines from text files?
^ and $ are anchors and indicate the start and end of the current record (which will be the current line with the default record seperator). If you mean to delete lines that only contain whitespace, this will do the trick:while (<STDIN>) { print if (!/^$/); }
(\s is the whitespace character, and includes newlines, spaces and tabs)while (<STDIN>) { print if (!/^\s*$/); }
Andrew.
|
|---|