in reply to dbi issues

I don't know whether you cut-and-pasted or typed it in directly, but some changes are below:

# 'strict' is your friend! use strict; ... # be sure to end each statement with a semicolon, and declar # all variables with 'my' my $sport = 'basket ball'; my $year = '1999'; # Egads, escaping quotes is so un-Perlish. DBI # placeholders make life much easier my $sql = qq/ SELECT round, teamname, score FROM trees WHERE sport = ? and year = ? ORDER BY round DESC /; # Turn on DBI error checking -- anything with an error # will immediately trigger 'die' $dbh->{RaiseError} = 1; # Prepare and plug in the values for the placeholders my $sth5 = $dbh->prepare( $sql ); $sth5->execute( $sport, $year ); my $rowcount = 0; my @list_of_teamdata = (); # It's probably easier to do this with hashes, but we'll # stick with your use of arrays. Fetching arrayrefs can # be faster, however, so we'll use those while ( my $row = $sth5->fetchrow_arrayref() ) { my $round = $row->[0]; my $teamname = $row->[1]; my $score = $row->[2]; # Using 'qw' as you had done isn't what you wanted -- # instead, just create an anonymous arrayref and stick # it in the list of results push @list_of_teamdata, [ $round, $teamname, $score ]; $rowcount++; } # Now print out your results -- use 'printf' for nicer # formatting :-) foreach my $info ( @list_of_teamdata ) { print "round $info->[0] team $info->[1] score $info->[2]\n"; }

There are more concise ways of doing this, but I wanted to change things just enough to work. We can get to efficiency and readability later :-)

Chris
M-x auto-bs-mode