sub getColnames{ my ($dbh,$tablename) = @_; my @columns; my ($sth) = $dbh->column_info(undef,undef,$tablename,'%'); while(my $row = $sth->fetchrow_hashref()){ push(@columns,$row->{COLUMN_NAME}); } return @columns; }