in reply to Re: "readdir() attempted on invalid dirhandle" error?
in thread "readdir() attempted on invalid dirhandle" error?

Interesting. Also, WTAF!

Same call -- open my $dh, q[<], q[./] or die $! -- also succeeds on FreeBSD 14.

Thinking bit more, does not make sense: Should Perl call open(2) with O_DIRECTORY flag -- where available -- so that call will fail if path is not a directory? Apparently it already does not (feel free to correct).