"... LIKE '%" . quotemeta($str) . "%' ..." #### my $pattern= $string_from_user; $pattern =~ s#(['%_\[\]])#\\$1#g; "... LIKE '%$pattern%' ..." #### LIKE '%\\\\\%%' #### # Escape "wildcard" characters in user input: my $pattern= quotemeta($string_from_user); # Escape things processed by 'single quote' parsing: $pattern =~ s#([\\'])#\\$1#g; "... LIKE '%$pattern%' ..."