use DBI;
my $driver="DBI:mysql";
my $database="sample_db";
my $user="root";
my $host="localhost";
my $dbh = DBI->connect("$driver:database=$database;host=$host;user=$user") or die "Can't connect: " . DBI->errstr;
print "Name: ";
chomp($name=);
my $sth=$dbh->prepare('SELECT count(*) from Employee WHERE name = ?');
$sth->execute($name);
print "Number of rows to be deleted: ", $sth->fetchrow_array(), "\n";
$num=$dbh->do(qq/DELETE from Employee WHERE name = ?/, undef,$name);
print ($num > 1 ?"$num rows deleted.\n":"$num row deleted.\n");
$sth->finish();
$dbh->disconnect();