in reply to Unicode error
Because
interprets the contents of $regex as a regular expression. What you want is:/$regex/
which interprets the variable contents as a string (by backslashing any non-"word" characters the same as quotemeta does)./\Q$string\E/
|
|---|