in reply to Re: upgrading activeperl
in thread upgrading activeperl
The script didn't work before the installation but it was just saying syntax error. This is my first attempt at perlscript rather than perl, and I was hoping win32::asp would be gentler on me
the script looks like this btw (it's building a decent query string for a site search.)
thanks, andyuse WIN32::ASP; $sqlStatement = ""; If (GetFormValue('SearchText') ne "") { my $conj; my $query=GetFormValue('SearchText'); $query=~s/([\(\)])/ $1 /g; $query=~tr/A-Z/a-z/; $query=~tr/a-z0-9() //cd; $query=~tr/ / /s; $query=~s/^ //; $query=~s/ $//; foreach $word (split(/ /,$query)) { if ($word=~/^(and|or|not|\(|\))$/) { $word=~tr/a-z/A-Z/; $sqlStatement.=" AND" if (($word eq "NOT") && ($preWord!=~ +/^and|or$/i)); $sqlStatement.=" $word"; $conj=$word; } else { $sqlStatement.=" AND" unless ($conj || !$sqlStatement); $sqlStatement.=" keywords LIKE '%$word%'"; $conj=""; } $prevWord=$word; } } $sqlStatement="WHERE $sqlStatement" if $sqlStatement; $Response->Redirect("search2.asp?searchtext=$sqlStatement"); %>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: upgrading activeperl
by Nkuvu (Priest) on Feb 24, 2003 at 20:49 UTC | |
by theandygrant (Initiate) on Feb 25, 2003 at 11:43 UTC |