Automagic Ticket property changes?

Hi all,

I was wondering if there are any hooks where I can put a Perl script
which will parse incoming emails & set up RefersTo and other properties
automagically.

Pointers to example code highly appreciated.

Thanks,
Richard