in reply to Using READDIR runs out of memory

I'm not sure what you mean to do with the map?

To get only names ending in .html, I would do this: my @jrnFiles = grep {/\.html$/} readdir DIR; Perl should be fine with 1 million files in the directory.