$PARENT=1; sub lock{ if ($flock_exists == 1){ local ($file_handle); foreach $file_handle (@_){ flock($file_handle, 2); } } } sub unlock{ if ($flock_exists == 1){ local ($file_handle); foreach $file_handle (@_){ flock($file_handle, 8); } } } sub cleanMessage{ select(STDOUT); print "Content-type: text/html\n\n"; if ($ENV{'QUERY_STRING'} == ''){ select(STDOUT); print "oh no!Must provide an argument!"; } $inp = "../message/".$ENV{'QUERY_STRING'}; $inp2 = "message/".$ENV{'QUERY_STRING'}; unlink $inp; open(IND,"+ ../message/bbs-data.html"); lock(IND); #locate string position # while($cool = ){ while(){ # if ( =~ $inp2){ # } # else { print; # } } #delete line from file close(IND); } &cleanMessage; select(STDOUT); print <<"END"; END