http://www.perlmonks.org?node_id=112972


in reply to Re: Is readdir ever deterministic?
in thread Is readdir ever deterministic?

Well, being truly defensive, you should have written:
foreach my $file ( grep { !/\A\.{1,2}\z/ } readdir DIR ) { munge($file); }
Or else the day someone creates a file named dot-newline or dotdot-newline, you'll be very angry.

-- Randal L. Schwartz, Perl hacker