my $dbh = "123456"; # just as a test, instead of DBI->connect(....); if ($dbh != valid_DBI_handle()) { print "please supply a PROPER reference to a DBI object, or whatever it's called\n"; } else { # okay, dbh actually points to a real db connection print "dbh is truly valid"; }