use IPC::SysV qw(IPC_PRIVATE S_IRWXU IPC_CREAT); use IPC::Semaphore; $sem = new IPC::Semaphore(IPC_PRIVATE, 10, S_IRWXU | IPC_CREAT); # and the crucial part: $sem->op($semaphoreNumber,0,0); # where first zero means wait-for-zero operation, # ie, your code will stop and wait (CPU-friendly) # until your semaphore becomes 0. #etc...