sub selectAll { my ($what,$table,@clauses); my $where = ""; if (@clauses) { $where = " WHERE " . join(" and ",@clauses); }; my $statement = "SELECT $what FROM $table $where"; my $sth = $dbh->prepare($statement); $sth->execute() or die "SQL: selectAll: '$statement' failed."; return $sth->fetchall_arrayref(); };