my $sth = $dbh->prepare("SELECT * FROM $tablename WHERE 1=0"); $sth->execute(); my $fields = $sth->{NAME};