#!/usr/bin/perl # use CGI qw/:standard/; $file = "lyrics.db"; $sinterpret = lc(param('interpret')); $stitle = lc(param('title')); print header; print "Interpret::$sinterpret\n"; print "
Title::$stitle
\n"; open (SR, $file); do { $rid = (); $interpret = lc(); $title = lc(); $ci = 9; $ct = 9; if ($sinterpret ne "") { do { ++$i; if (substr($interpret, $i, length($sinterpret)) = $sinterpret) { $ci = 1; } else { $ci = 9; } } until ($i < length($interpret) or $ci = 1) } else { $ci = 6; } if ($stitle ne "") { if (length($stitle) <= length($title)) { if ($stitle = $title) { $ct = 1; } else { for ($j = 0; $j < length($title); ++$j) { if (substr($title, $j, length($stitle)) = $stitle) { $ct = 1; } else { $ct = 9; } } } } } else { $ct = 6; } # $ci / $ct Results: # # 9 - False # 1 - True # 6 - Empty $a = $ci + $ct; if ($a eq 7) { print "
$rid matches - Variable returned : $a --------- $interpret - $title\n"; } if ($a eq 2) { print "
$rid matches - Variable returned : $a --------- $interpret - $title\n"; } } until (eof(SR))