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