in reply to Re: How can I find and delete a line from a file?
in thread How can I find and delete a line from a file?

This actually won't delete the line, since the implied print gets done as part of the continue portion of the loop, which happens even after a next.

To delete, I think you'd need to substitute the matched line with null, but given that, I think the more obvious way is to switch to explicitly printing, like:

perl -i -n -e 'print if not /^sandwich,hamburger,/i' comma.file
This one-liner also takes advantage of the -i switch to edit the file in place, which seemed to be desired in the original question.