in reply to ActiveState's HTML documentation

You may want to take a look at the modules in ActivePerl::DocTools. The processing is done by subs in those modules, notably in ActivePerl::DocTools::WriteTOC(). There is module documentation for this, but unfortunately it is scanty and incomplete. I spent a couple of minutes looking at the mods themselves, and at a brief glance it looks like it should be relatively easy to figure out how to use them.

Update: Oop! dvergin got in ahead of me, and has actually pointed you to a script that implements the modules I mentioned. Good show, dvergin!

-HZ