sub unlock{ my $self=shift; my $FH=*{$$self{SEMAPHORE}}; if(-e $SEM){ flock($FH,LOCK_UN); close $FH; unlink $SEM; } }