in reply to Perl encoding problem

You need to add use utf8;.


Unless you use use utf8;, Perl expects your code to be encoded using ASCII. Literals are 8-bit clean.[1]

I'm guessing you didn't use use utf8;. If that the case, you can't possibly have /behälter/ since ä isn't found in the ASCII character set. You're actually giving Perl something equivalent to /beh\xC3\xA4lter/.

As you indicated, the proper solution is to give /beh\xE4lter/ or equivalent. For /behälter/ to be equivalent, you need to encode your source code using UTF-8 (as you're already doing), and you need to tell Perl you've done that using use utf8; (which needs doing).


  1. This means that "<byte with value 0xFF>" is equivalent to "\xFF".