# SYNTAX: getColumnList($dbh, "TestTable") sub getColumnList { # grab aliases to a DB handle and a table name my($dbh,$table) = @_; my $sth = $dbh->prepare("SELECT * FROM $table WHERE 1=0;"); $sth->execute; my @cols = @{$sth->{NAME}}; # or NAME_lc if needed $sth->finish; # return now complete list of columns for the given table return @cols; }