Thanks to everyone for the great input on my last question.  Here's another.

There has to be a better way to modify/delete lines in a file than this.

    my $filename = "thefile";
    my $lineToDelete = "I'm a bad line, delete me.";

    open(FILE, "< $filename");
    open(FILE_TMP, "> $filename.tmp");

    while(<FILE>){
        next if /$lineToDelete/;
        print FILE_TMP;
    }

    close(FILE);
    close(FILE_TMP);
    rename( "$filename.tmp", $filename);



David

Reply via email to