sub update_my_session { my ($nickname, $time, $customer_id, $sid); open(SDB, "/usr/local/...") || die; my @array = ; close(SDB); open(INFILE, ">/usr/local/...") || die; flock INFILE, 1; for (@array) { chomp; ($nickname, $time, $customer_id, $sid) = split( /\|/, $_); $time = time() if $sid eq $sessionid; print INFILE "$nickname|$time|$customer_id|$sid\n"; } flock SDB, 8; close(INFILE); }