I am having a problem with a script I'm writing for a search button. it
works just fine except when I'm searching for a part number with a letter in
it. I am searching through a comma delimited database. If I have A35CH5 and
A22F4, and I search for A22F4, my script will read through my dbase and spit
out part number A35CH5. I tried this with a part number that had a letter in
the middle like 9C452 and 95H33. Again, I searched for 95H33 and it spit out
9C452. Here is a copy of my script. If you could offer any help, I would be
grateful.
#!/usr/bin/perl
require("cgi-lib.pl");
print "Content-type: text/html\n\n";
$header = "/usr/home/m/ma/mayline/mayline.com/testnav.html";
unless(open(DAT, "../pricelist.db")) {
die, "Cannot Open File: pricelist.db" };
print "<html><head><title>Search Results</title>";
print `cat $header`;
print "<font size=-1 color=\"black\">\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
chomp($buffer);
($text, $info) = split(/=/,$buffer);
while ($data = <DAT>) {
($product, $page) = split(/,/,$data);
if ($product eq $info) {
print "Part number $product found on page $page.<br>\n";
print "<a
href=\"http://www.mayline.com/pricebookpdf/2001pricebook.pdf\#$page\&zoom=10
0\"> Click here</a> to view the page.<br><br>\n";
print "</font></body></html>\n";
die;
}
}
print "Cannot find record\n";
print "</font></body></html>\n";
exit(0);