No, your incorrect use of _utf8_on (or equivalent such as the :utf8 PerlIO layer) is causing that. use bytes kinda fixes your earlier bug.
$ perl -MEncode=_utf8_on -e'$s = "\xF1\xF4"; _utf8_on($s); "" =~ /$s/'
Malformed UTF-8 character (unexpected non-continuation byte 0xf4, imme
+diately after start byte 0xf1) in regexp compilation at -e line 1.
Malformed UTF-8 character (1 byte, need 4, after start byte 0xf4) in r
+egexp compilation at -e line 1.
Malformed UTF-8 character (unexpected non-continuation byte 0xf4, imme
+diately after start byte 0xf1) in regexp compilation at -e line 1.
Malformed UTF-8 character (1 byte, need 4, after start byte 0xf4) in r
+egexp compilation at -e line 1.
$ perl -MEncode=_utf8_on -e'$s = "\xF1\xF4"; "" =~ /$s/'
$
|