Database handle with perl always undefined

I am having issues getting a simple DBI connection using perl to work.

I put a place checker to see if the database handle is undefined and it always comes out undefined. Are there any blatant errors? I'm assured that the info I enter is correct, as I'm using it in a php script.

#!/usr/bin/perl -w
use warnings;
print "Content-Type: text/html\n\n";

use DBI;

# Connecting to the database
# Replace DATABASENAME with the name of the database,
# HOSTNAME with the hostname/ip address of the MySQL server.
$drh = DBI->install_driver("mysql");
$dsn =   "DBI:mysql:database=db_name;host=host_name";
$dbh = DBI->connect($dsn,"username","password");
if(defined $dbh)
    print "Yes<br />";
    print "No<br />";

 # Select the data and display to the browser

   $sth = $dbh->prepare("SELECT * FROM customer");
   while (my $ref = $sth->fetchrow_hashref()) {
   print "Found a row: id = $ref->{'cid'}";


# Disconnect from the database.



An error occured if connect returned undef. Throw some error handling in there. It might give you some useful information.

$dbh = DBI->connect($dsn, $user, $pw)
   or die "Unable to connect: $DBI::errstr\n";

Need Your Help

Extra text being added to Repeater field Label

.net text internet-explorer-8

This is only happening in IE8 (I don't have IE7 or IE9 to test on). In firefox it looks fine.

EF 6.1 and maintaining views

c# entity-framework ef-code-first ef-migrations entity-framework-6.1

Yesterday i asked this question: Generating a SQL view from EF 6.1 code first