Hi Brett
I created a service like you suggested but when I run it it seems like nothing happens. When I run it in the Automator with sample text it creates the right formatting though.
My automator service is setup like so:
Service receives selected text in any application
Input i sent ire selection [tick] Output replaces selected text
Run Shell Script
Shell: /usr/bin/perl Pass input: to stdin