my $rval = ''; my $sth2 = $dbh->prepare("SHOW COLUMNS FROM $table"); $sth2->execute() or die 'execute failed'; if ( $sth2->err ) { $rval = 'error: [' . $sth2->errstr . ']'; } else { # the "while" line is #151 from the error message... while ( my @arr = $sth2->fetchrow_arrayref() ) { $rval .= '[' . join('|', @arr ) . ']'; } } #### mysql> show columns from cmsParms; +--------+-----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-----------+------+-----+---------+-------+ | pKey | char(100) | NO | PRI | NULL | | | pValue | text | NO | | NULL | | +--------+-----------+------+-----+---------+-------+ 2 rows in set (0.01 sec)