opendir(DIR, "$HTMLDir") || die "[opendir] '$HTMLDir' ($!)";@list = readdir(DIR);closedir(DIR);foreach $file (@list) { ... process each $file }
If I understand this correctly ;One approach can be to generate a table of contents (TOC) of HTML files from header tags by processing multiple files using existing named anchors inside header tags .