CREATE TABLE mytable ( person VARCHAR(20), lasttime INTEGER ); #### my $sql = "INSERT INTO mytable (person,lasttime) VALUES ?, ?"; my $sth = $dbh->prepare( $sql ); if ( $sth && $sth->prepare( $person, time() ) ) { ; # success } else { die( "DB Error " . $dbh->errstr . "\n" ); } #### my $timenow = time(); my $fiveminutes = 5 * 60; # 60 seconds times five my $timethen = $timenow - $fiveminutes; my $sql = "DELETE FROM mytable WHERE lasttime < ?"; my $sth = $dbh->prepare( $sql ); if ( $sth && $sth->execute( $timethen ) ) { ; # success } else { die( "DB Error " . $dbh->errstr . "\n" ); }