my $sql = "SELECT borrowernumber, categorycode FROM borrowers WHERE dateenrolled >= ?";
if ($not_expired) {
$sql .= " AND dateexpiry > NOW()"
$sql .= " AND dateexpiry >= NOW()"
}
my $sth = $dbh->prepare($sql);
$sth->execute($since);
-