Here is what I'm trying to do. We'll call the Perl cgi script "engine" in this explanation.
If engine finds a file name ending in *.asp (inside the HTML source code, of course), the engine will rewrite it as *.aspex.
In addition, when engine finds a file name ending in *.asp, it will also adding a predefined line of code ("/newdir/") inside the HTML source code, provided they're all inside an anchor.
Another way to visualize the concept:
Current:
<a href="/index.asp">Link</a>
New:
<a href="/newdir/index.aspex">Dir Link</a>
Thanks in advance!