my $dbh = DBI->connect('dbi:mysql:owner_db','searcher','searcherpasswd') or die "Connection Error: $DBI::errstr\n"; $sth = $dbh->prepare ("DELETE FROM my table WHERE POSTED < DATE_SUB(NOW(), INTERVAL 30 DAY)"); $sth->execute ();