use fcntl qw(:DEFAULT :flock); use DB_File; $lck = $path/whosonline . ".lockfile"; sysopen(DBLOCK, $LCK, O_RDONLY | O_CREAT) or die "can't open $lck: $!"; flock(DBLOCK, LOCK_SH) or die "cant lock_sh $lck: $1"; dbmopen %who, "$path/whosonline", 0666 or die "Can't open FILENAME: $!\n";# open database, accessed through %mname tie %who, "DB_File", "$path/whosonline" or die "Can't open FILENAME: $!\n"; # open database tie hash to db $V = $who{$points}; # retrieve from database this is the key $who{$Account::cata_acc} = "$time"; # put value into database this is the value if (exists $who{"$Account::cata_acc"}) { # check whether in database } untie %who ; dbmclose %who; # close the database close DBLOCK; #done checking whosonline