
Zeke D
Deleted
Apr 14, 2001, 9:43 AM
Post #1 of 2
(227 views)
|
|
text matching in a pipe-delimited database
|
Can't Post
|
|
I am trying to do a search in a pipe-delimited database. A form gathers two variables: $setfile - the file to search. $query - the text to match. Here is the code I have so far, that doesnt work:
sub results2 { open ("setfile", "$setfile")||die print "cannot open $setfile."; @data = <setfile>; foreach $data (@data) { $backup = "$data"; if (!($query =~ /$data/i)) { ($cardname,$cost,$type,$class,$power,$tough,$text,$flavor,$set,$rarity,$artist) = split ('[|]',$backup); print "$cardname<BR>$cost<BR>$type $class<BR>$power/$tough<BR>$text<BR>$flavor<BR>$set<BR>$rarity<BR>$artist<HR>"; } else { print ""; } } close (setfile); } It needs to compare the query to each variable in the Database, and each line is a seperate entry.
|