in reply to File editing

Something like this could do what you want:

open SOURCE,"<source.file" or die "Error opening source.file: $!"; open DEST,">dest.file" or die "Error opening dest.file: $!"; while ($line = <SOURCE>) { next if ( 1 .. ($line =~ /RE/) ); print DEST $line; }

And the you can rename dest.file to source.file.
HTH

James

Update: Followed tilly's advices about warnings and errors

Replies are listed 'Best First'.
RE (tilly) 2: File editing
by tilly (Archbishop) on Sep 28, 2000 at 17:13 UTC
    First of all those die statements are very uninformative. At the least you should say the attempted action, the filename, and report the OS error with $!. For something this simple there is no reason to not just read from @ARGV with <>.

    If you have ever had to get a broken script with useless error reporting working again at midnight when it turns out that someone (not me!) had been mucking around as root and left permissions wrong on one file in several thousand, you will appreciate why I am a stickler for this!

    Secondly you will lose the end of the line with the RE, so you didn't quite answer the problem stated. OTOH I suspect that you did answer the question that really was meant.