... unless ( flock($fh, LOCK_EX|LOCK_NB )) { if ($verbose) { print "Another instance of \"$0\" is already running. Exiting...\n"; } exit(0); } ...