#!/usr/bin/perl -w

use strict;
use DBI;

my $thing = shift || 'muttley';

my $dbh = DBI->connect( 'dbi:mysql:diana',
                        '$username',
			'$password'
                      ) || die "DB connection not made - $DBI::errstr\n";

$thing = $dbh->quote("%$thing%");


{
 my $sql = qq{select pkey, pvalue from t_are where pkey like $thing or pvalue like $thing};
 my $sth = $dbh->prepare($sql); $sth->execute;
 while (my ($key, $value) = $sth->fetchrow_array)
 {
	print "$key are $value\n";
 }
 $sth->finish;
 $sth = undef;
}

{
 my $sql = qq{select pkey, pvalue from t_is where pkey like $thing or pvalue like $thing};
 my $sth = $dbh->prepare($sql); $sth->execute;
 while (my ($key, $value) = $sth->fetchrow_array)
 {
	print "$key is $value\n";
 }
 $sth->finish;
 $sth = undef;
}

$dbh->disconnect;
exit 0;


syntax highlighted by Code2HTML, v. 0.9