my (@tables, %map); my $q = $dbh->prepare("show tables"); $q->execute or die "Error listing tables"; while ( my ($table) = $q->fetchrow_array ) { push @tables, $table; } $q->finish; for my $table (@tables) { $q = $dbh->prepare("describe $table"); $q->execute or die "Error describing table $table"; while ( my $hr = $q->fetchrow_hashref ) { push @{ $map{$table} }, $hr->{Field}; } $q->finish; }