my $sth5 = $dbh->prepare("select round, teamname, score from trees where sport = ‘$sport’ and year = ‘$year’, order by round") || die "Can't prepare SQL get data statement"; $sth5->execute || die “can’t execute sql statement”; ##need to get all the data one row at a time from the table. my @row; while (@row = $sth5->fetchrow_array) { need to put each row into a hash. }