in reply to script problems1

First, use strict and enable warnings (yes, again with that ... it will help you catch errors such as "unintialized value" errors (which, from your description, is highly likely to be the problem here), and keep you from having to come back to us as often as you are).

It is not enough to sprinkle your code with my declarations, you need to enable the checks!

Second, let me comment on your DB code:

$sth = $dbh->prepare("SELECT year from trees WHERE sport = \'$sport\' +AND year = + \'$year\'") || die "couldn't prepareSQL statement"; $sth->execute || die "can't execute sql statement"; my @row; while (@row = $sth->fetchrow_array()) { $year = $row[0]; }

Learn to use placeholders: that prepare is more securely written as

$sth = $dbh->prepare('SELECT year FROM trees WHERE sport = ? AND year = ?' );

When you do that, you put the variables that are going into the places that are being held into the execute call:

$sth->execute($sport, $year) or die "Can't execute: ". $db->errstr(). "\n";

Finally, since you know you're only snagging one datum, that while loop (which appears in more than one spot here) has the potential to confuse. Just do

my ($year) = $sth->fetchrow();

and follow that up with a $sth->finish.

OK, now for your hashes: you could do both hashes in one go:

for (1.. $compsize *2 -1) { $teams{"team$_"} = $cgi->param("team$_"); $scores{"score$_"} = $cgi->param("score$_"); }

Now, if the hashes aren't populated the way you think they should be, the most likely thing that's going on is that you're not getting parameters of the right form: so check that out first, put in some debugging code such as:

print "<ul>\n"; foreach ( $cgi->param) { print "<li>$_: '", $cgi->param($_) ,"'\n"; } print "</ul>\n";

This will tell you whether you're getting the input you think you're getting.

Philosophy can be made out of anything. Or less -- Jerry A. Fodor