Can someone take a look at this and see what is wrong?   I am still 
learning perl and this is giving me a tough time.

The email.txt file is an empty file and has the correct permissions.

Thanks

Chris

# This section needs to cycle through the emails.txt file.
# Once it has cycled through the file completely,
# it needs to search the array? and see if the new email address
# is there.  If it is, do nothing. If it is not, add it to the
# end of the file.
#Opens the counter file to get current number of plays
open (LOGEMAIL, "email.txt") || die "Can't open email.txt file for reading.";
flock (LOGEMAIL, 2); # Locks the file
@emailfile = <LOGEMAIL>; # Assigns the data from the file into an array
         foreach $emailfile(@emailfile) { # Loops through for each record
         ($new_email) = split(/\|/, $logemailfile);
         $new_email = lc($new_email); # lowercase
         $email = lc($email);         # lowercase

         if('$new_email' eq '$email'){
                 last;
         }
         else{
                 $ok_to_log_email='1';
         }
}
         if($ok_to_log_email == '1'){
         flock (LOGEMAIL, 8); # Unlocks the file
         close(LOGEMAIL);

         # Log the new player.
         open (LOGEMAIL, ">>email.txt") || die "Can't open email.txt file.";
         flock (LOGEMAIL, 2); # Locks the file
                 print LOGEMAIL "$email|\n"; # write to file
         flock (LOGEMAIL, 8); # Unlocks the file
         close(LOGEMAIL);
         }


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

Reply via email to