Slurping can be a problem if your files are large. This one-liner avoids that by using -n instead of -p:
perl -i -ne '/^$/ or print' foo.txt
In reply to Re: how to use matching operator on newlines
by BrowserUk
in thread how to use matching operator on newlines
by redss
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |