I copy/pasted your first attempt
$field[3] ="hello how are you today";
$FORM{'keyword'}="today";
if ($field[3] =~/$FORM{'keyword'}/i) {$found="1";}
and it worked for me. You may want to add a couple of print statements before your test to see if they contain the values you think they do.
$field[3] ="hello how are you today";
$FORM{'keyword'}="today";
print "DEBUG(field[3]) = $field[3]\n";
print "DEBUG(FORM{'keyword'}) = $FORM{'keyword'}\n";
if ($field[3] =~/$FORM{'keyword'}/i) {$found="1";}
print "DEBUG(found) = $found\n";
> -----Original Message-----
> From: Johnno [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 22, 2002 08:52
> To: [EMAIL PROTECTED]
> Subject: [Perl-unix-users] Help please with a search routine
>
>
> I am trying to do a search type routine, but having a few problems..
>
> ie.
> in $field[3] ="hello how are you today"
> in $FORM{'keyword'}="today"
>
> now below is what i toying with... what is suppose to happen is..
> If anywhere in $field[3] contains what is in $FORM{'keyword'}
> if will set
> the var $found ="1"
>
> if ($field[3] =~/$FORM{'keyword'}/i) {$found="1";}
>
> I have even tried
>
> if ($field[3] =~/\(?:$FORM{'keyword'})\b/i) {$found="1;}
>
> but still having no luck..
>
> Can someone help me please??
>
> Many Thanks,
> Johnno
>
>
>
> _______________________________________________
> Perl-Unix-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>