It seems to me that there should be a more direct way to do it, but you could do:
my $sql = "SELECT * FROM FOO"; my $arrayref = $dbh->selectall_arrayref($sql, { Columns => {} }); my @names; foreach my $key (keys %{$arrayref[0]}){ push @names, $key; } Which would leave you with a reference to an array containing one hashref per result row and, again, an array containing the names of all your columns. Brian McCain ----- Original Message ----- From: "Manisha Gupta" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 18, 2003 2:57 PM Subject: retrieving column names from a table using DBI module Hello I am working with Perl CGi. There is a query where i have to select all columns in a table and display the data on the web page. the query is something like "select * from <tablename> But the problem is I am not able to get the column names. I am using the DBI module. Is there a way to get column names? Thanks