in reply to check if databse exists before connection is made!

You've answered your own question. If the $db is not defined you know that the database doesn't exist or it couldn't connect. You can rule out whether it was a problem connecting or if the database doesn't exists by checking the error string. The error will probably be in $!.
  • Comment on Re: check if databse exists before connection is made!