in reply to Getting a list of columns from a MySQL Table

After you call $sth->execute, you should be able to get the number and names of columns via
  $sth->{NUM_OF_FIELDS}
and
  $sth->{NAME}->[$n]
where $n is an index from 0..$sth->{NUM_OF_FIELDS}-1