In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] writes:
>     $old = "oldfile.txt";
>     $new = "newfile.txt";
>
>     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: $!";
>   rename($old,$new);
>
>
>  Is there something inherently wrong with doing it this way? 

See, when you post something that plainly isn't what you're 
using (because it doesn't compile), how can anyone tell what 
the problem is with what you really are doing, since they can't 
see your real code?

% perl -c
     $old = "oldfile.txt";
     $new = "newfile.txt";

     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: $!";
   rename($old,$new);
^D
syntax error at - line 6, near ",>"
- had compilation errors.

That's twice now.  I'm disinclined to help since I will doubt that whatever
you post is what's really giving you the problem, because you evidently
don't want to show us the real code.

-- 
Peter Scott
http://www.perldebugged.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to