in reply to OS-integrated Perl

PGP has a "tray" icon in Windows that offers, among other things, to process the text on the clipboard and process the selection in the current window. That sounds like the same kind of stuff you are talking about.

A really simple way would be to copy the text to the clipboard, and then run a program that takes a script from the clipboard instead of a file. Make that run from an icon somewhere or bind to a global hotkey or whatever. That should be do-able on any modern GUI.