Generally, we prefer to help people DEBUG their mod_rewrite code at WebmasterWorld, not write it for them. Although someone may jump in here and offer a solution, you could start with this Intro to mod_rewrite [webmasterworld.com] (and follow the links it includes if it's too basic) or try a post in the Commercial Exchange forum.
i see that you write perl scripts. i loaded shed loads of spider c-blocks into my database then wrote a script that checked if the visitor was a spider or not. depending on this check you can serve different content.
you can maintain a table of visitorips which you can purge say every half an hour.
i actually used this for logging purposes rather than serving different content but the principle is the same. i now have a system where i have visits and pageviews for both humans and spiders.
why not implement something like this in perl? just remember to update your spider list every now and then.