Check data in mysql

Hi, I just would like to write a perl script , this perl script do the following .

Check the parameter $data in a mysql database ( with user ID and password ) , if the $data is exist then return true , if not then return false , would advise how to write this script ? thanks

---------- Post updated 05-04-14 at 06:29 AM ---------- Previous update was 05-03-14 at 09:01 PM ----------

I have the below perl script to connect the mysql db , would advise how to change it to check if the parameter $data is exist in mysql database or not , then return true or false ? thanks

use DBI
use strict;
my $driver = "mysql"; 
my $database = "TESTDB";
my $dsn = "DBI:$driver:database=$database";
my $userid = "testuser";
my $password = "test123";
my $dbh = DBI->connect($dsn, $userid, $password ) or die $DBI::errstr;

This is an example(in addition to what you already have done) to access a table in a mysql database:
How to Use Perl to Connect to a Database � Perl
How to Connect to MySQL from Perl and Select Records with Example