my $sth = $dbh->prepare('SELECT * FROM applicants WHERE date_col = ? ORDER BY date_col, job_position'); $sth->execute($date) or die $sth->errstr; while (my @result = $sth->fetchrow_array()) { print qq(@result\n); }