
Listing 10:  SQL query and printout section of reporting script

# Query database for a count of results
@counter=$dbh->selectrow_array($querycount)
	|| die "Failed database lookup: $DBI::errstr\n";

# Query database for actual results
$query_ref=$dbh->selectall_arrayref($querything)
	|| die "Failed database lookup: $DBI::errstr\n";
# @report_ref is an array of references to arrays of each row returned:
@report_ref=@$query_ref;
$report_size=scalar(@report_ref);
