in reply to Need help with efficient processing

I may miss the point here, but why not simply building a hash as you go over the directory once.

foreach (readdir(DIR)) { if (/^([a-z0-9]*?-[a-z]{2}-[a-z]{2,3})-(\d{8})(-eol)?\.(pdf|html)$ +/) { push(@{$files{$1}}, $2); } }
This can than be sorted in a second pass by:
foreach (keys %files) { $files{$_} = [sort @{$files{$_}}]; }

Hope this helps, -gjb-