in reply to using htaccess to call a perl script
Use RewriteCond
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
If you include a very complicated regex, eventually you will find it difficult to handle, is better:
RewriteCond -general case or regex-
RewriteRule -action for general case-
Then add case:
RewriteCond -particular case or regex-
RewriteRule -action for particular case-
RewriteCond -general case or regex-
RewriteRule -action for general case-
No need to remember who did the regex