[comp.lang.perl] Perl Script Idiom for DOS batch files.

tony@oha.UUCP (Tony Olekshy) (03/07/91)

In message <1991Mar4.165742.12909@holos0.uucp>, lbr@holos0.uucp (Len Reed)
writes:
>
> In article <1991Mar1.041441.4810@ccu1.aukuni.ac.nz> russell@ccu1.aukuni.ac.nz
> (Russell J Fulton) writes:
>
> > Is there and equivalent of #!.../perl for MS dos .bat files?
>
> I could not find a general solution to this problem.

Ok.  First, create a copy of perl.exe called #.exe.  Second, create an empty
file called $$.bat.  Now, your .bat/perl code looks like...

	# %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
	$$ ;

	Your Perl Code Here

At least, this works under DOS 3.2.  It relies on the non-nesting nature of
your script.bat and $$.bat files.

--
Yours etc., Tony Olekshy.       Internet: tony%oha@CS.UAlberta.CA
				  BITNET: tony%oha.uucp@UALTAMTS.BITNET
				    uucp: alberta!oha!tony
Nothing does more hurt in a state than that cunning men pass for wise. --Bacon