Re: Corrupted Data

From: Tore Aursand (tore_at_aursand.no)
Date: 10/30/03


To: beginners@perl.org
Date: Thu, 30 Oct 2003 18:19:28 +0100

On Thu, 30 Oct 2003 09:45:58 -0500, Jimstone77 wrote:
> open(OLD,">$old") or die "Can't Open File: $!";
> flock OLD, 2;
> open(NEW,$new) or die "Can't Open File: $!";
> flock NEW, 2;
> while (<OLD>) {
> if ($_ =~ /NO_EMAIL/) {
> $count++;
> }
> else {
> print NEW $_;
> }
> }
> close(NEW) or die "Can't Close File: $!";
> close(OLD) or die "Can't Close Old: $!";

First of all: Post your _actual_ code. The code above won't even
compile, and it's really easy to see (or find out) why.

Secondly, you're trying to write to a file you opened for reading.

-- 
Tore Aursand <tore@aursand.no>