$qry = $DB->Query("SELECT * FROM recipes WHERE type = '$type' ORDER BY rand() limit $quantity") || die "Got error on select: $Mysql::db_errstr\n"; for ($i=0; $i<$qry->numrows; $i++) { @row = $qry->fetchrow or warn "recipes didn't find a matching row"; print "\@row is assigned @row\n"; $j = 0; foreach my $bug (@row) { $athlete[$i][$j++] = $bug ; print "\$i\$j is assigned $i:$j\n"; print "\$athlete[\$i,\$j] is assigned the value $athlete[$i][$j]\n"; print "\$bug is assigned the value $bug\n"; } } }