First, your code looks pretty good for a non programmer. It would be a lot easier to read if it were posted in [CODE] [/CODE] tags to preserve the formatting. Please edit your posts accordingly.
It seems to me that you you should be loading from the existing Db, those records that match any one of the fields of interest. If the returned dataset is non-empty, then you know that at least one record exists matching one of your fields, and you can exit with a '
-1' exit code or return value. You will need to have something to search for, which can be specified by parameters passed from the commandline.
Code that looks something like this may help.
Code:
my $inputPrice = $ARGV[0];
my $inputName = $ARGV[1];
#
# Compose a query string (assuming some table column names here)
#
my $queryString = "SELECT * from Cars WHERE Name like '%$inputName%' or Price like '%$inputPrice%'";
It isn't clear what is meant by 'information is invalid or incomplete'. I guess that one criterion is that both of the 'name' and 'price' arguments must be non-empty. Perhaps you have some criteria that evaluates the input for well-formedness, but you will need to expand on what those criteria are.
--- rod.