in reply to checking whether DBI connection made

There have been a lot of good suggestions so far. I just wanted to add my .16th of a bit (as in shave-and-a-haircut bits, not the memory bits).

If a DBI->connect fails, there will be an error string set in DBI::errstr. This is analogous to the $dbh->errstr when you have an open db handle. The perldoc on DBI will have more info.

e.g.

my $dbh = DBI->connect('DBI:stack_of_papers_on_my_desk', 'user', 'pw') or die DBI::errstr;

elbieelbieelbie