in reply to foreach and opendir differences

It's the difference between shell expansion using * and ..., well, readdir.

perldoc perlop, perldoc -f glob, and perldoc File::Glob
has a lot of info about <> and its many behaviors. As you're using it with foreach, you're globing in list context, using glob behavior as per a /bin/csh. I poked through man csh a bit, but can't find a documented reason why an asterisk would ignore dotfiles. When I'm in csh and bash, a ls /dir/* also ignores dotfiles, so I guess it's working as expected.

readdir, on the other hand, probably uses the readdir system call, documented in man 3 readdir. It actually reads the directory as a file, which is a list of inodes and always contains . and .. as entries.

As far as the code tags... no idea. there's probably some page with instructions for writeups we should have read somewhere. I just lurked for a bit and copied people ;)