The OP's posted code does not include an assignment to $scandir
It does not, but the OP does mention UTF-8, so
$scandir being UTF-8 is a possibility, to say the least.
The OP's posted code does not contain umlauts
It doesn't have to be umlauts, what matters is whether
$scandir is UTF-8. Make this change to your code and see what happens:
use utf8; # just for utf8::upgrade
# bytewise, this is already UTF-8...
my $scandir = './pm_1080490_utf8_readdir';
#... but we need to flag it as such for
# the problem to manifest itself:
utf8::upgrade $scandir;
# now on to readdir
the OP's posted code does not require use utf8
Right, it does not. And
use utf8 is not absolutely necessary in the above test code - use
-CS/binmode or -CA to initialize
$scandir.
If you're referring to the output from that containing:
FLAGS = (PADMY,POK,pPOK,UTF8)
Then the UTF8 part of that is caused by the umlaut in 'für'.
Does that code not answer your:
[use utf8] has nothing to do with the:... flagging variables
# under 'use utf8'
FLAGS = (PADMY,POK,pPOK,UTF8)
... "f\303\274r"\0 [UTF8 "f\x{fc}r"]
# no utf8
FLAGS = (PADMY,POK,pPOK)
... "f\303\274r"\0
Does the first variable have the UTF8 flag or does it not? What about the second variable? Aren't those two strings exactly the same?
I'm out of this thread.