use warnings; use strict; use IPC::Shareable; tie my $lock, 'IPC::Shareable', { key => 'LOCK', create => 1, exclusive => 1, destroy => 1, graceful => 1 }; $lock = $$; print "procID: $lock\n"; sleep 5;