Your problem is that you cannot just edit a file in place. All you are changing is the line which is in a variable in memory, it never gets to the disk. The most concise way to do this is to open the file, and then print out all the lines except the one you don't want. Then you can redirect the output to another file. Also, some of perl's command-line arguments can help you accomplish that:
#!/usr/bin/perl -nw use strict print unless /$var/i; # or a perl one-liner perl -i.bak -nwe 'print unless /019/i' <file>
HTH
Addendum: RE: Abigail's comments: Added the -e switch. And the 'gi' is just following the orginal poster since 019 may not be the only data (s)he is looking for, didn't want the confuse the issue if they plugged in some other data and it was missing. I suppose the 'g' is superfluous in this case, guess you can safely remove that one.
In reply to Re: Deleting a line out of text file
by pzbagel
in thread Deleting a line out of text file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |