in reply to Formatting question??

> Any formating suggestions how this can be done?

Using Data::Dumper and then trying to reformat its output shows a bad case of cargo-cult coding. Don't do that.

My suggestion is that you learn how to use references. Right now, you are using Data::Dumper to do the extraction for you - this is the part of it that you want - but you don't want the output formatted the way that Data::Dumper does it. The answer is to step away from the whole mess and do it right: extract the references, dereference them to the actual underlying data structure (an array, in the case of 'fetchall_arrayref'), and print out the elements of that array in the way you want them.

You also need to read the DBI documentation and figure out which fetch method you want to use in order to get the information you want. If you want both the field names and the field values - as you imply - then perhaps 'fetchrow_hashref' would serve you better.

You should also learn how to use the 'printf' command to format your output. Very basic example of code - something you can expand and rework to suit your purposes, not blindly copy - follows:

#!/usr/bin/perl -w # use strict; use DBI; $|++; # Create the variables that will be loaded from '.dbinfo' our ($db, $table, $user, $pass, $query); # Load them up do ".dbinfo" or die "Database info not found!\n"; my $dbh = DBI->connect("DBI:mysql:$db", $user, $pass); my $sth = $dbh->prepare("select $query from $table"); $sth->execute; while (my $hash_ref = $sth->fetchrow_hashref){ for my $key (keys %$hash_ref){ printf "%-10s: %s\n", $key, $hash_ref->{$key}; } }

-- 
Human history becomes more and more a race between education and catastrophe. -- HG Wells