in reply to function called by regex

You can do the following...
s/pattern/doit($1,$2,$3)/e;
and variations. The e modifier treats the right hand as perl code, and whatever is returned is substituted.

                - Ant
                - Some of my best work - (1 2 3)