$filelock from the main program will be third scalar returned
from sieve_util_set_flagfile. This function has a variable
$filelock, which is never set. But it's returned as the
third scalar. Now, the loop also uses a variable $filelock,
but that's lexical to the loop.
I don't know what your intention is of '$filelock', so I
cannot offer any suggestion of what to do.
Abigail