in reply to Need help with efficient processing

my %hash; for ( readdir DIR ) # or wherever your filenames come from. { if ( /^([a-z0-9]*?-[a-z]{2}-[a-z]{2,3})-(\d{8})(-eol)?\.(pdf|html)$/ + ) { push @{ $hash{$1} }, $_; } }
And there you have it.

Now, if you want to access the keys and filenames in sorted order, you could do --
for my $key ( sort keys %hash ) { print "Files for $key:\n"; for my $file ( sort @{ $hash{$key} } ) { print "\t$file\n"; } }

jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.