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


in reply to Strange Error

You could try the glob() function instead of filtering the contents of the directory yourself, like this:

my @files = glob("*.txt");