See
perldoc perlre
and search for \Q
Dan
"Lee, Janet" wrote:
>
> Hi all.
>
> Everyone has been so helpful with my other questions, I thought I would put
> out another one.
>
> I'm writing a script that searches through an array of hashes. One of the
> possible fields in the hash is "Comments" and sometimes the comments have
> characters such as ? or * in them. Right now, my search line looks like this
>
> if ($myhash{$searchVar} =~ /$value/i) {
> do stuff;
> }
>
> which works fine for regular text, but chokes up if $value is something like
> ** due to the matching. I know backslashes would help if I knew in advance
> it would be **, but the user sets the $value variable on the fly. Is there
> an easy way to get around this problem? TIA
>
> janet