Hashes are random. Changing foreach my $key (keys %documents) to foreach my $key (sort keys %documents) would sort by filename RT appears to already sort multiple versions of a file by date. -- Cambridge Energy Alliance: Save money. Save the planet.