Code:
if (param('deletepuser')) { $deletepuser = param('deletepuser');
open (GUEST,"$private") ||die $!;
flock(GUEST, LOCK_SH);
@lines=<GUEST>;
flock(GUEST, LOCK_UN);
close(GUEST);
open (GUEST,">$private") || die $!;
flock(GUEST, LOCK_EX);
foreach (@lines) {
chomp;
if($_ ne ""){
($a,$b)=split(/__/,$_);
if($deletepuser ne $b){
print GUEST "$_\n";
}
}
}
flock(GUEST, LOCK_UN);
close(GUEST);
above is to deletete record of email in a text file my text file are as
name__email
email__email
so, any similar mail submitted from form will be deleted however
I can only delete the last entry in the record file if it is same submitted from form
the non-last entry in record file cannot be deleted...
anything wrong of my code..........
thanks