#!/usr/bin/perl
($n,$v) = split (/=/,<STDIN>);
print"Content-type:text/html\n\n";
if ($v < 4000000 || $v > 9999999) {
print 'Invalid information : error';
exit;
}
$filename = 'data.txt';
open(myfile,"$filename");
@getrec = <myfile>;
close(myfile);
$cntrec = @getrec;
unlink("$filename");
open(myfile,">$filename");
for $i (0 .. $cntrec-1) {
($id,$passwd) = split(",",$getrec[$i]);
if ($v ne $id) {
print myfile $getrec[$i];
} else {
$found=1;
}
}
close(myfile);
if ($found){print'Delete ok';}else{print'Not found';}
จำนวน : 24 บรรทัด