Ok, I saw various responses, and, if what you want is a "batch" file to invoke PERL, you cannot do it as ".bat", rather, a very old trick is to make the fike a ".cmd" and have it assoc'd as a .bat file. (or closely there of). From a script that someone VERY generously gave me back 15 yrs ago(and I still use) is this: 1) you make it LOOK like a BAT file 2) invoke PERL.
Here's a working snipplet to do HELLO WORLD. I'll walk thru it afterwords: @rem = ' @echo off perl -S %0.cmd goto endofperl @rem '; # this came from A VERY Clever person years ago....(no galaxies) print "Hello World\n"; exit (0); # end script. # these lines required. __END__ :endofperl Ok, what this does is tell the BAT file that: @rem = ' Lets the script(BAT) act as a DOS script. The other '@' are escaping things, Then it invokes your PERL script (whatever.cmd) When PERL invokes this EXACT script, it thinks '@rem' and other stuff are vars and exits. It then proceedes to execute! To run this example, just save it (eg thingy.cmd) and type "thingy" (since .cmd is part of the invocation) Seriously cool trick (from some JEDI-PERL dude(wich I new who it was) in a galaxy near you!) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Thomas Sent: Sunday, September 04, 2005 7:13 AM To: [EMAIL PROTECTED] Cc: [email protected] Subject: Re: .bat to .pl Hi, Thanks for all your replies. A few points about the batch file I would like to convert is that it has the following: 1) labels and goto's 2) if statements 3) variables I tried the first suggestion on the following batch file that uses labels and gotos: goto.bat ====== :begin echo hello world goto begin goto.pl ===== use strict; use warnings; my $command; $command=':begin'; system ($command); $command='echo hello world'; system ($command); $command='goto begin'; system ($command); This shows that it's not just about transferring the commands from .bat to .pl. What's needed is something that understands DOS batch labels and goto's, if statements and variables. Would it still be helpful if I got the actual batch file I am would like to convert? I WHISH I had written it in PERL to begin with........ Thanks, Richard. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Richard Thomas Sent: Saturday, September 03, 2005 4:22 PM To: [email protected] Subject: .bat to .pl Hi, Does anyone know of a way to convert an MS-DOS batch script (.bat) into a PERL script (.pl) automatically, without having to start writing the PERL script from scratch? Thanks in advance _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
