Remove string from file

As I have been trying to figure out how to remove a specific string and not leave a blank line in a file, perl has really saved my day.
perl -ni -e 'print unless/mydomain.com/' virtualdomains |
Back to developing scripts now 🙂
Hope this helps someone too.