http://www.perlmonks.org?node_id=306781


in reply to Clipboard transform keys

pl2bat is your friend
E:\>more hi.pl print "hi\n"; E:\>pl2bat hi.pl E:\>hi hi E:\>more hi.bat @rem = '--*-Perl-*-- @echo off if "%OS%" == "Windows_NT" goto WinNT perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9 goto endofperl :WinNT perl -x -S %0 %* if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl if %errorlevel% == 9009 echo You do not have Perl in your PATH. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul goto endofperl @rem '; #!perl #line 15 print "hi\n"; __END__ :endofperl

Replies are listed 'Best First'.
Re^2: Clipboard transform keys
by PhilHibbs (Hermit) on Nov 13, 2003 at 15:01 UTC
    I have a few variants of my own, for different perl installations. Some machines in the office have 5.00502 installed but not in the path, so I add a handful of extra lines that handle this. Also, some of my perl batches are self-logging.