[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-WebCGI] Using CGI Parameters As Regex Switches



I set up an html search form so that the user can decide whether to 
conduct a case sensitive or insensitive search. The parameter passed 
is either case=i or case =" " and what I thought I could do was then 
plug this selection directly into the pattern matching, e.g.

if ($line =~ /^$searchterm/$case)

However, Perl does not like this at all and I wound up having to use

if ($case = "i" && $line =~ /^$searchterm/i) {
do stuff;
}
elsif ($case = " " && $line =~ /^$searchterm/) {
do stuff;
}

Is there a way to just embed the $case as a switch like I wanted to 
do in the first place? Thanks.

Richard Gordon
--------------------
Gordon Consulting & Design
Database Design/Scripting Languages
mailto://maccgi@bellsouth.net
770.565.8267

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org