sub find_entries { my $sql = "SELECT * " . "FROM foo " . "WHERE this " . "LIKE '%" . $this . "%' " . "AND that " . "LIKE '%" . $that . "%' " . "AND other " . "LIKE '%" . $other . "%'"; my $sth = $dbh->prepare($sql); $sth->execute; ... return $entries; }