in reply to Re: How to find MySQL database exist or not
in thread How to find MySQL database exist or not

I would not make the same change. Why bother wrapping an "X or die" inside an eval, then check whether X is false afterwards?
if ($dbh = DBI->do('dbi:mysql: xxxxx','root','')) { print "Table exists\n" } else { print "Table does not exists"; }
Of course, all it checks is whether one can connect - not whether a database exists (title question) or whether a table exists (message printed).

Replies are listed 'Best First'.
Re^3: How to find MySQL database exist or not
by roboticus (Chancellor) on Sep 01, 2011 at 16:07 UTC

    JavaFan:

    Good point. I just saw the $blah == 'undef' and was immediately horrified.

    ;^)

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Re^3: How to find MySQL database exist or not
by choroba (Cardinal) on Sep 01, 2011 at 16:09 UTC
    And, once we are at nitpicking, it checks it after the program starts, not before (per spec). :)
Re^3: How to find MySQL database exist or not
by edi (Initiate) on Sep 02, 2011 at 11:16 UTC
    thank you JavaFun for the reply. but it is giving an error as follows: Name "main::dbh" used only once: possible typo at C:/Program Files..... Can't locate auto/DBI/do.al in @INC