use DBI; my $dbh = DBI->connect("DBI:mysql:db_name","user","pass") || die $DBI::err; $dbh->do("delete from mytable where to_days(rec_timestamp) < to_days(now()) - 90");