Program that uses file locking -- UNIX
$LOCK_EX = 2; $LOCK_UN = 8; open(DB, ">>datafile") || die "Can't open: $!\n"; flock(DB, $LOCK_EX) || die ; print DB "asdf:asdf\n"; flock(DB, $LOCK_UN) || die;