in reply to perl mysql and cgi 2

my @cols = @{$sth->{NAME}};

If you want to receive all rows, you have to do something like

while (my @row = $sth->fetchrow_array) { # use @row here }

Please read the DBI documentation, or if you find that confusing, a short guide to DBI.

Perl 6 - links to (nearly) everything that is Perl 6.