use DBI;
$driver="DBI:mysql";
$database="sample_db";
$user="root";
$host="localhost";

$dbh=DBI->connect('dbi:mysql:sample_db','root','password',{
             RaiseError => 1, 
             PrintError => 0, 
}
) or die $DBI::errstr;

$sth=$dbh->prepare("SELECT name FROM Employee") or die "Can't prepare sql statement" . DBI->errstr;
$sth->execute();
while(my @val = $sth->fetchrow_array()){
    print "name=$val[0]\n";
}
print $sth->rows," rows were retrieved.\n";
$sth->finish();
$dbh->disconnect();