in reply to MySQL Database Check...

You can just run a grep on the result of the DBI tables method.
Besides being fast, it is also portable, since it is not MySQL specific.
The core instruction you need is
print "table exists" if grep {"tablename" eq $_ } $dbh->tables;
Below, there is a complete example.

#!/usr/bin/perl -w use DBI; use strict; my $dbh = DBI->connect("DBI:mysql:mysql;host=localhost", "username","password", {RaiseError => 1}) or die "can't connect\n"; # # Checks for a table in a given database # sub table_exists { my ($dbh, $table) = @_; return grep {$table eq $_} $dbh->tables } my $mytable = "user"; if (table_exists($dbh,$mytable)) { print "table $mytable exists"; } else { print "table $mytable does not exist"; } $dbh->disconnect();