I often see snippets of code that I want to be executed: examples of code on PM site, on p5p list. To check reported bug whether it is a bug, or just weird behaviour.
I select code, start file manager, go to special dir, create file, cut-n-paste contents and then run it.

Today I've invented a really easy way to do this much more comfortable: just select a text, copy it to clipboard and execute special .bat file
(I named it cperl.bat, but could be any other)

perl -MWin32::Clipboard -we "eval Win32::Clipboard::GetText(); print S +TDERR $@ if $@"
really simple cperl.bat but my life now easier :)

Replies are listed 'Best First'.
Re: Execute Perl script from Win32 Clipboard instantly
by The Mad Hatter (Priest) on Aug 21, 2003 at 16:56 UTC
    Nice (if you are on win32, at least). My routine is to copy the code, execute cat >t; perl t; rm t in an xterm (which I always have open), paste the code in, and press ctrl-d.
Re: Execute Perl script from Win32 Clipboard instantly
by PhilHibbs (Hermit) on Aug 22, 2003 at 13:10 UTC
    That's nice - combine it with my Clipboard transform keys for extra productivity! Copy the Perl code, hit the magic key, and it executes! I think the shortcut can be set up to stay visible after completion.
Re: Execute Perl script from Win32 Clipboard instantly
by Mr. Muskrat (Canon) on Aug 21, 2003 at 17:02 UTC
    What if that snippet does something evil?
      Then don't run it!

      Actually my "cperl.bat" needed to shorten a way to run a piece of code that I see on screen. When I go longer way (using temprary file on disk), I also must ask myself "What if that snippet does something evil".

      My script do not change security level, it just shortens code snippet execute timecycle!

      Courage, the Cowardly Dog

        Ah! But you cannot always tell what a snippet will do at first glance. Seemingly innocent code could do evil things just the same as evil looking code could be perfectly innocent.