From: c23mts@kocrsv01.delcoelect.com (Mike Scheidler)
Newsgroups: comp.lang.perl
Subject: How to run a Perl under DOS?
Message-ID: <1993Jan6.211929.169@kocrsv01.delcoelect.com>
Date: 6 Jan 93 21:19:29 GMT
Sender: news@kocrsv01.delcoelect.com (Usenet News Account)
Reply-To: c23mts@kocrsv01.delcoelect.com
Organization: Delco Electronics Corp.
Lines: 17
Originator: c23mts@kocrsw12


Could someone shed some light on how to execute a script using one of
the DOS ports of perl?

I've seen an example somewhere which wraps the invocation of PERL.EXE into
a .BAT file (using %0 through %9 to pass any parameters), but it doesn't
seem to exit cleanly for me when using DOS 5.0.

Any help would be appreciated.

Thanks!

-- 
Mike Scheidler                    INTERNET:  c23mts@kocrsv01.delcoelect.com
Software Technology               UUCP:      deaes!c23mts
Delco Electronics Corporation     PHONE:     (317) 451-0642
Kokomo, IN 46904                  GMNET:     8-322-0642

From: grover@dawkins.cs.unlv.edu (Kevin Grover)
Subject: Re: How to run a Perl under DOS?
Message-ID: <1993Jan7.194156.4618@unlv.edu>
Sender: news@unlv.edu (News User)
Reply-To: grover@isri.unlv.edu
Organization: Information Science Research Institute (UNLV-ISRI)
References: <1993Jan6.211929.169@kocrsv01.delcoelect.com> <1993Jan7.182209.1931@unipalm.co.uk>
Date: Thu, 7 Jan 93 19:41:56 GMT
Lines: 28

In article <1993Jan7.182209.1931@unipalm.co.uk>, ian@unipalm.co.uk (Ian Phillipps) writes:
) 
) I've recently moved over to this idiom:
) 
)     @rem = '
)     some dos batch commands
)     PERL -S %0.BAT %1 %2 %3 (etc)
)     GOTO ENDOFPERL
)     ';
)     # your perl script here
)     __END__
)     :ENDOFPERL
)     some more DOS if you need it
)     rem Drop through end of Batch file
) 

They best i've found to call PERL, is from 4DOS.  Add this line to
your autoexec.bat file:
	set .PL=C:\BIN\PERL.EXE		(or where ever your exe lives)

Then, any file ending in .PL is automatically a executable perl
script.  The benefit of this is that redirection on the command line
works (it's pretty flaky w/ batch files).

--------------------------------------------------------------------------
 Kevin O. Grover      | UNLV Computer Science and Electrical Engineering
 grover@isri.unlv.edu | ISRI - Information Science Research Institute
 CServe: [73627,1677] | 4505 S. Maryland Parkway, Las Vegas NV 89154-1017

From: manaster@yu1.yu.edu (Chaim Manaster)
Newsgroups: comp.lang.perl
Subject: Re: How to run a Perl under DOS?
Summary: Please explain the batch file.
Message-ID: <1268@alsys1.aecom.yu.edu>
Date: 7 Jan 93 23:18:38 GMT
References: <1993Jan6.211929.169@kocrsv01.delcoelect.com> <1993Jan7.182209.1931@unipalm.co.uk>
Sender: news@alsys1.aecom.yu.edu
Organization: School of Engineering and Applied Sciences, UCLA
Lines: 48
Nntp-Posting-Host: yu1.yu.edu

In article <1993Jan7.182209.1931@unipalm.co.uk> ian@unipalm.co.uk (Ian Phillipps) writes:
>c23mts@kocrsv01.delcoelect.com (Mike Scheidler) writes:
>
>
>>Could someone shed some light on how to execute a script using one of
>>the DOS ports of perl?
>
>>I've seen an example somewhere which wraps the invocation of PERL.EXE into
>>a .BAT file (using %0 through %9 to pass any parameters), but it doesn't
>>seem to exit cleanly for me when using DOS 5.0.
>
>I've recently moved over to this idiom:
>
>    @rem = '
>    some dos batch commands
>    PERL -S %0.BAT %1 %2 %3 (etc)
>    GOTO ENDOFPERL
>    ';
>    # your perl script here
>    __END__
>    :ENDOFPERL
>    some more DOS if you need it
>    rem Drop through end of Batch file
>
I am fairly new to all of this and don't quite understand how this
DOS batch (that apparently contains aPerl script) works or how it
passes the parameters from the command line to the Perl script.
How is the switch from DOS batch processing to Perl script
processing accomplished and why does the DOS batch proccessor skip
over al of the Perl script line? I am sure that its obvious to most
of you out there, but I sure don't have the finer points down quite
yet. If you could run down the above batch file with line by line
explanations, I would surely appreciate it, and hopefully
understand it too.

Thanks for the help.

Henry Manaster

-- 
***************************************************************************
	Henry Manaster          *     EMail: manaster@yu1.yu.edu
	Brooklyn, NY            *
                                *
	Disclaimer: The above is not necessarily MY opinion nor that 
				of anyone else :-)  ????!
****************************************************************************
 

From: buboo@alf.uib.no (Ove Ruben R Olsen)
Subject: Re: How to run a Perl under DOS?
Message-ID: <1993Jan8.032628.1949@alf.uib.no>
Organization: University of Bergen, Norway
References: <1993Jan6.211929.169@kocrsv01.delcoelect.com>
Date: Fri, 8 Jan 93 03:26:28 GMT
Lines: 21

Mike Scheidler writes:

>Could someone shed some light on how to execute a script using one of
>the DOS ports of perl?
>
>I've seen an example somewhere which wraps the invocation of PERL.EXE into
>a .BAT file (using %0 through %9 to pass any parameters), but it doesn't
>seem to exit cleanly for me when using DOS 5.0.

We use this for DOS-5.00:

@REM = (qq:
@echo off
perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
@end :) ;
# End of #! emulation for MS-DOS perl.


\Ruben.
(Want's to replace c:\command.com with c:\bin\perl)

-- 
        Ove Ruben R Olsen a Gnarfer and VI user. EMAIL: ruben@uib.no. 
     Maintaining the EX/VI-archive and a couple of the Comp.Editors FAQs.
    People that are ignorant tend to live a frustrated life, at least when 
     it comes to editing - But I do belive this is a general rule in life

Newsgroups: comp.lang.perl
Subject: Re: How to run a Perl under DOS?
Message-ID: <1270@alsys1.aecom.yu.edu>
Date: 8 Jan 93 16:38:25 GMT
References: <1993Jan7.182209.1931@unipalm.co.uk> <1268@alsys1.aecom.yu.edu> <1993Jan8.071450.7631@netcom.com>
Sender: news@alsys1.aecom.yu.edu
Organization: School of Engineering and Applied Sciences, UCLA
Lines: 67
Nntp-Posting-Host: yu1.yu.edu


In article <1993Jan8.071450.7631@netcom.com> jfh@netcom.com (Jack Hamilton) writes:
>1  >>    @rem = '                   
>2  >>    some dos batch commands
>3  >>    PERL -S %0.BAT %1 %2 %3 (etc)
>4  >>    GOTO ENDOFPERL
>5  >>    ';
>6  >>    # your perl script here
>7  >>    __END__
>8  >>    :ENDOFPERL
>9  >>    some more DOS if you need it
>10 >>    rem Drop through end of Batch file

...

>(3), like (2), is ignored in perl, but calls the perl interpreter in batch.
>The -S options means "search the path for the script".  The "%0" expands to
>the name of the file.  The remaining things are just parameters to be
>passed to perl. 
>
>(4) is ignored in perl, but in DOS it's a GOTO command pointing to (8).
>The contents of (5)-(7) are perl commands, and probably won't be valid DOS
>commands.  The GOTO just skips over them. 

Why does Perl skip over the GOTO? That is a valid command in Perl
(even if illadvised). So in effect, both the batch and Perl
processors are interpreting the same file over again. Neat.
How does the expansion of the %0-%9 parameters work? Apparently
this is done twice, once in the batch processor and again in the
Perl processor. Is that right? Thus which meta characters must be
escaped and Once or twice?

I put all my batch files in a \bat directory which is on the path,
so the batch processor will find any bat file in it, I suppose I
still need the -s so that Perl will know to search the path as
well?

By the way, in all the Perl stuff I have read so far, I keep seeing
references to "globbing", is this just another way of saying
"command line expansion"?

>You do something similar using the -x command line  option instead of the -S
>command line option. 

What's the difference between the two?

Thanks for the help. I thought it was something along these lines,
but the details escaped me. I think I got it now.

Henry Manaster

P.S. I keep seeing references to "sockets" in the Perl docs. I have
no idea what this means, other than that it doesn't work in the DOS
versions of Perl. I assume it is a unix term. What does this mean
or do?
Thanks again.
HM

-- 
***************************************************************************
	Henry Manaster          *     EMail: manaster@yu1.yu.edu
	Brooklyn, NY            *
                                *
	Disclaimer: The above is not necessarily MY opinion nor that 
				of anyone else :-)  ????!
****************************************************************************
 

From: manaster@yu1.yu.edu (Chaim Manaster)
Newsgroups: comp.lang.perl
Subject: Re: How to run a Perl under DOS?
Message-ID: <1272@alsys1.aecom.yu.edu>
Date: 10 Jan 93 03:50:18 GMT
References: <1993Jan8.071450.7631@netcom.com> <1270@alsys1.aecom.yu.edu> <1993Jan8.220106.10383@netcom.com>
Sender: news@alsys1.aecom.yu.edu
Organization: School of Engineering and Applied Sciences, UCLA
Lines: 46
Nntp-Posting-Host: yu1.yu.edu

In article <1993Jan8.220106.10383@netcom.com> jfh@netcom.com (Jack Hamilton) writes:
>>>1  >>    @rem = '                   
>>>2  >>    some dos batch commands
>>>3  >>    PERL -S %0.BAT %1 %2 %3 (etc)
>>>4  >>    GOTO ENDOFPERL
>>>5  >>    ';
>>>6  >>    # your perl script here
>>>7  >>    __END__
>>>8  >>    :ENDOFPERL
>>>9  >>    some more DOS if you need it
>>>10 >>    rem Drop through end of Batch file

>>Why does Perl skip over the GOTO?
>
>Because it's inside a quoted string, the one which starts on line 1 and
>ends on line 5.  As far as perl is concerned, it's not a statement.

Right, that should have been obvious.

>>How does the expansion of the %0-%9 parameters work? Apparently
>>this is done twice, once in the batch processor and again in the
>>Perl processor. Is that right? Thus which meta characters must be
>>escaped and Once or twice?
>
>The parameters are expanded only by DOS.  They're inside single quotes and
>not expanded.  And even if they were, they'd still be inside a string, so
>nothing would happen. 

I am still very confised on this one. If my batch file is named
"howdy" and my DOS command line is: Howdy firstname lastname, then
firstname gets passed to %1 and lastname gets passed to %2. Then,
when Perl is activated it passes %1 and %2 to @ARGV. Where do the
single quotes youtalk about come into the picture? Also if  there
were no single quotes (no matter where they come from) would Perl
then do an expansion as well?


-- 
***************************************************************************
	Henry Manaster          *     EMail: manaster@yu1.yu.edu
	Brooklyn, NY            *
                                *
	Disclaimer: The above is not necessarily MY opinion nor that 
				of anyone else :-)  ????!
****************************************************************************
 

From: manaster@yu1.yu.edu (Chaim Manaster)
Newsgroups: comp.lang.perl
Subject: Re: How to run a Perl under DOS?
Message-ID: <1278@alsys1.aecom.yu.edu>
Date: 11 Jan 93 18:46:39 GMT
References: <1993Jan8.220106.10383@netcom.com> <1272@alsys1.aecom.yu.edu> <1993Jan11.062312.323@netcom.com>
Sender: news@alsys1.aecom.yu.edu
Organization: School of Engineering and Applied Sciences, UCLA
Lines: 61
Nntp-Posting-Host: yu1.yu.edu

In article <1993Jan11.062312.323@netcom.com> jfh@netcom.com (Jack Hamilton) writes:
>>>>>1  >>    @rem = '                   
>>>>>2  >>    some dos batch commands
>>>>>3  >>    PERL -S %0.BAT %1 %2 %3 (etc)
>>>>>4  >>    GOTO ENDOFPERL
>>>>>5  >>    ';
>>>>>6  >>    # your perl script here
>>>>>7  >>    __END__
>>>>>8  >>    :ENDOFPERL
>>>>>9  >>    some more DOS if you need it
>>>>>10 >>    rem Drop through end of Batch file
>>
>>I am still very confised on this one. If my batch file is named
>>"howdy" and my DOS command line is: Howdy firstname lastname, then
>>firstname gets passed to %1 and lastname gets passed to %2. Then,
>>when Perl is activated it passes %1 and %2 to @ARGV. Where do the
>>single quotes youtalk about come into the picture? Also if  there
>>were no single quotes (no matter where they come from) would Perl
>>then do an expansion as well?
>
>The quotes just make 1-5 a literal to perl.  When perl is called, it isn't
>called as "perl howdy.bat %1 %2", it's called as "perl howdy.bat firstname
>lastname" - the arguments have already been expanded by DOS.  If there were
>no quotes of any kind, the whole thing would blow up.  If there were double
>quotes, perl would (I think) try to interpret %1, etc as associative
>arrays.  It still works, but it seems to take a little longer. 

I still have problems understanding your response.
As you say above, the DOS batch processor gets:
	perl howdy.bat %1 %2
and expands it to:
	perl howdy.bat firstname lastname
What I don't see is where either the single quotes or double quotes
you refer to, come from. The only quotes in the script above,
enclosing lines 1-5 (single quote) are used by perl once it has
already been invoked and for all practile purposes thrown away.
Teh line seen by the perl line as seen by the DOS processor has NO
quotes (of either kind) at all. So the last three or four lines of
your reply above still confuse me.

My original question was meant to be, if (for example) lastname was
replaced by Henry$lastname would perl expand the $lastname part of
the parameter, and would DOS either choke or expand it as well? And
if you wanted to prevent expansion by either DOS or perl what would
you do?

Thanks again.

Henry Manaster



-- 
***************************************************************************
	Henry Manaster          *     EMail: manaster@yu1.yu.edu
	Brooklyn, NY            *
                                *
	Disclaimer: The above is not necessarily MY opinion nor that 
				of anyone else :-)  ????!
****************************************************************************
 

From: ian@unipalm.co.uk (Ian Phillipps)
Subject: Re: How to run a Perl under DOS?
Message-ID: <1993Jan7.182209.1931@unipalm.co.uk>
Organization: Unipalm Ltd., 216 Cambridge Science Park, Cambridge CB4 4WA, UK
References: <1993Jan6.211929.169@kocrsv01.delcoelect.com>
Date: Thu, 7 Jan 1993 18:22:09 GMT
Lines: 28

c23mts@kocrsv01.delcoelect.com (Mike Scheidler) writes:


>Could someone shed some light on how to execute a script using one of
>the DOS ports of perl?

>I've seen an example somewhere which wraps the invocation of PERL.EXE into
>a .BAT file (using %0 through %9 to pass any parameters), but it doesn't
>seem to exit cleanly for me when using DOS 5.0.

I've recently moved over to this idiom:

    @rem = '
    some dos batch commands
    PERL -S %0.BAT %1 %2 %3 (etc)
    GOTO ENDOFPERL
    ';
    # your perl script here
    __END__
    :ENDOFPERL
    some more DOS if you need it
    rem Drop through end of Batch file

Ian
-- 
Ian Phillipps, Unipalm Ltd, 216 Science Park,		Phone +44 223 420002
Milton Road, Cambridge, CB4 4WA, England.		Phax  +44 223 426868
PIPEX is a division of Unipalm Ltd. - phone 0223 424616.

From: jfh@netcom.com (Jack Hamilton)
Subject: Re: How to run a Perl under DOS?
Message-ID: <1993Jan8.071450.7631@netcom.com>
Organization: Netcom - Online Communication Services (408 241-9760 guest)
References: <1993Jan6.211929.169@kocrsv01.delcoelect.com> <1993Jan7.182209.1931@unipalm.co.uk> <1268@alsys1.aecom.yu.edu>
Date: Fri, 8 Jan 1993 07:14:50 GMT
Lines: 62

In article <1268@alsys1.aecom.yu.edu> manaster@yu1.yu.edu (Chaim Manaster) asks how the foillowing script works: 

1  >>    @rem = '                   
2  >>    some dos batch commands
3  >>    PERL -S %0.BAT %1 %2 %3 (etc)
4  >>    GOTO ENDOFPERL
5  >>    ';
6  >>    # your perl script here
7  >>    __END__
8  >>    :ENDOFPERL
9  >>    some more DOS if you need it
10 >>    rem Drop through end of Batch file


I added line numbers to the left to make it easier to explain.

(1) is a valid statement in both perl and DOS batch.  In perl, it starts an
assignment statement which is finished in (5); in DOS, it's an unechoed
remark command. 

(2), which can be several lines, is just DOS commands.  When the file is
executed as a perl script, these commands are ignored, because they're
imbedded inside the string started in (1).  When the file is executed as a
batch file, they're executed (DOS doesn't know about continuations), so you 
can use them for setup or whatever. 

(3), like (2), is ignored in perl, but calls the perl interpreter in batch.
The -S options means "search the path for the script".  The "%0" expands to
the name of the file.  The remaining things are just parameters to be
passed to perl. 

(4) is ignored in perl, but in DOS it's a GOTO command pointing to (8).
The contents of (5)-(7) are perl commands, and probably won't be valid DOS
commands.  The GOTO just skips over them. 

(5) is skipped over when the file is executed as batch, but ends the
assignment statement started in (1) when executed as a perl script. 

(6) is any number of perl statements.   

(7) is a special perl statement.  It indicates that the end of the program
has been reached.  Perl will not treat anything after this line as a
program statement.  This example didn't show it, but you could put data
lines after (7), and read them from your perl program using the filehandle
DATA. 

Note that __END__ has a total of 4 underscores. 

(8) is interpreted only by DOS.  It's a label, and the object of the GOTO
in (4).  

(9) and (10) and just DOS commands. 


You do something similar using the -x command line  option instead of the -S
command line option. 


-- 

-----------------------------------------------------------------------
Jack Hamilton   jfh@netcom.com   P. O. Box 281107   SF, CA   94128-1107

From: jfh@netcom.com (Jack Hamilton)
Subject: Re: How to run a Perl under DOS?
Message-ID: <1993Jan8.220106.10383@netcom.com>
Organization: Netcom - Online Communication Services (408 241-9760 guest)
References: <1268@alsys1.aecom.yu.edu> <1993Jan8.071450.7631@netcom.com> <1270@alsys1.aecom.yu.edu>
Date: Fri, 8 Jan 1993 22:01:06 GMT
Lines: 101

In article <1270@alsys1.aecom.yu.edu> manaster@yu1.yu.edu (Chaim Manaster) 
writes:
>
>>1  >>    @rem = '                   
>>2  >>    some dos batch commands
>>3  >>    PERL -S %0.BAT %1 %2 %3 (etc)
>>4  >>    GOTO ENDOFPERL
>>5  >>    ';
>>6  >>    # your perl script here
>>7  >>    __END__
>>8  >>    :ENDOFPERL
>>9  >>    some more DOS if you need it
>>10 >>    rem Drop through end of Batch file
>
>Why does Perl skip over the GOTO?

Because it's inside a quoted string, the one which starts on line 1 and
ends on line 5.  As far as perl is concerned, it's not a statement.

>That is a valid command in Perl
>(even if illadvised). So in effect, both the batch and Perl
>processors are interpreting the same file over again. Neat.

Yes, but for the most part they don't execute the same lines.  DOS doesn't
execute lines 5 through 7, and perl doesn't execute 2-3 or 8-10. 

>How does the expansion of the %0-%9 parameters work? Apparently
>this is done twice, once in the batch processor and again in the
>Perl processor. Is that right? Thus which meta characters must be
>escaped and Once or twice?

The parameters are expanded only by DOS.  They're inside single quotes and
not expanded.  And even if they were, they'd still be inside a string, so
nothing would happen. 

>I put all my batch files in a \bat directory which is on the path,
>so the batch processor will find any bat file in it, I suppose I
>still need the -s so that Perl will know to search the path as
>well?

Yes.  Also, you can't call it as XYZ.BAT, only as XYZ. 

>By the way, in all the Perl stuff I have read so far, I keep seeing
>references to "globbing", is this just another way of saying
>"command line expansion"?

File name expansion. 

>>You do something similar using the -x command line  option instead of the -S
>>command line option. 
>
>What's the difference between the two?

They're just different.  I think the -x form is easier to understand.
There may be some drawbacks to it, but I haven't done anything complicated
enough to run into them. 

Here's a simple example: 

----- START -----

@echo off
perl -x c:\batch\calc.bat
goto :exit

#!perl

print 'Enter an expression: ';

while (<>)
   {
   print eval $_, "\n";
   print $@;
   last if !/\S/;
   print 'Enter an expression: ';
   }

__END__

:exit

----- END -----

>P.S. I keep seeing references to "sockets" in the Perl docs. I have
>no idea what this means, other than that it doesn't work in the DOS
>versions of Perl. I assume it is a unix term. What does this mean
>or do?

If I understand it correctly (which I might not - I'm not a networking
person), sockets are a way to communicate with other programs via a
network.  You can send messages through a socket and have them processed by 
a machine somewhere on the other side of the world, maybe. 

I don't know why it doesn't work in the DOS versions of perl.  I assume
that no one has gone to the trouble of compiling a version with socket
support built in.  There are socket libraries available for PC's. 

-- 

-----------------------------------------------------------------------
Jack Hamilton   jfh@netcom.com   P. O. Box 281107   SF, CA   94128-1107

From: jfh@netcom.com (Jack Hamilton)
Subject: Re: How to run a Perl under DOS?
Message-ID: <1993Jan11.062312.323@netcom.com>
Organization: Netcom - Online Communication Services (408 241-9760 guest)
References: <1270@alsys1.aecom.yu.edu> <1993Jan8.220106.10383@netcom.com> <1272@alsys1.aecom.yu.edu>
Date: Mon, 11 Jan 1993 06:23:12 GMT
Lines: 32

In article <1272@alsys1.aecom.yu.edu> manaster@yu1.yu.edu (Chaim Manaster) 
writes:
>>>>1  >>    @rem = '                   
>>>>2  >>    some dos batch commands
>>>>3  >>    PERL -S %0.BAT %1 %2 %3 (etc)
>>>>4  >>    GOTO ENDOFPERL
>>>>5  >>    ';
>>>>6  >>    # your perl script here
>>>>7  >>    __END__
>>>>8  >>    :ENDOFPERL
>>>>9  >>    some more DOS if you need it
>>>>10 >>    rem Drop through end of Batch file
>
>I am still very confised on this one. If my batch file is named
>"howdy" and my DOS command line is: Howdy firstname lastname, then
>firstname gets passed to %1 and lastname gets passed to %2. Then,
>when Perl is activated it passes %1 and %2 to @ARGV. Where do the
>single quotes youtalk about come into the picture? Also if  there
>were no single quotes (no matter where they come from) would Perl
>then do an expansion as well?

The quotes just make 1-5 a literal to perl.  When perl is called, it isn't
called as "perl howdy.bat %1 %2", it's called as "perl howdy.bat firstname
lastname" - the arguments have already been expanded by DOS.  If there were
no quotes of any kind, the whole thing would blow up.  If there were double
quotes, perl would (I think) try to interpret %1, etc as associative
arrays.  It still works, but it seems to take a little longer. 

-- 

-----------------------------------------------------------------------
Jack Hamilton   jfh@netcom.com   P. O. Box 281107   SF, CA   94128-1107

From: jfh@netcom.com (Jack Hamilton)
Subject: Re: How to run a Perl under DOS?
Message-ID: <1993Jan12.170523.9871@netcom.com>
Organization: Netcom - Online Communication Services (408 241-9760 guest)
References: <1272@alsys1.aecom.yu.edu> <1993Jan11.062312.323@netcom.com> <1278@alsys1.aecom.yu.edu>
Date: Tue, 12 Jan 1993 17:05:23 GMT
Lines: 45

In article <1278@alsys1.aecom.yu.edu> manaster@yu1.yu.edu (Chaim Manaster) writes:
>In article <1993Jan11.062312.323@netcom.com> jfh@netcom.com (Jack Hamilton) writes:
>>>>>>1  >>    @rem = '                   
>>>>>>2  >>    some dos batch commands
>>>>>>3  >>    PERL -S %0.BAT %1 %2 %3 (etc)
>>>>>>4  >>    GOTO ENDOFPERL
>>>>>>5  >>    ';
>>>>>>6  >>    # your perl script here
>>>>>>7  >>    __END__
>>>>>>8  >>    :ENDOFPERL
>>>>>>9  >>    some more DOS if you need it
>>>>>>10 >>    rem Drop through end of Batch file
>>>
>What I don't see is where either the single quotes or double quotes
>you refer to, come from. The only quotes in the script above,
>enclosing lines 1-5 (single quote) are used by perl once it has
>already been invoked and for all practile purposes thrown away.

Right.

>Teh line seen by the perl line as seen by the DOS processor has NO
>quotes (of either kind) at all. So the last three or four lines of
>your reply above still confuse me.

Perhaps I was misunderstanding your question. 

>My original question was meant to be, if (for example) lastname was
>replaced by Henry$lastname would perl expand the $lastname part of
>the parameter, and would DOS either choke or expand it as well?

If you have a PC, why don't you just try it yourself?  It may be a better
way to learn.  Try both kinds of quote marks.

>And
>if you wanted to prevent expansion by either DOS or perl what would
>you do?

Perl won't expand inside single quotes.  I'm not sure how I'd escape a
percent sign in DOS because I've never needed or wanted to do so, and my
DOS manual is all the way on the other side of the room.  

-- 

-----------------------------------------------------------------------
Jack Hamilton   jfh@netcom.com   P. O. Box 281107   SF, CA   94128-1107

From: goldfish@cebu.sbi.com (P. Goldsmith)
Newsgroups: comp.lang.perl
Subject: Re: Copying files; system and exec for MS-DOS perl?
Message-ID: <804@cebu.sbi.com>
Date: 7 Jan 93 13:52:47 GMT
References: <1993Jan2.220240.16046@athena.mit.edu> <5ygswB5w165w@cybrspc.UUCP>
Organization: Salomon Brothers, Inc
Lines: 21

In article <5ygswB5w165w@cybrspc.UUCP> roy%cybrspc@cs.umn.edu (Roy M. Silvernail) writes:
>aeichsta@athena.mit.edu (Andrew J. Eichstaedt) writes:
>>...
>> perl -e "system('dir')" seems to do nothing in the DOS version, whereas 
>...
>It appears (and I'll have to do some experimenting to verify this) that
>perl is handling the system() call without a new instantiation of the
>command processor.  The 'dir' command is a builtin for command.com and
>...

but "xcopy" is an external command ...

	system ("xcopy $old $new") || die " ... $!";

(but then, doesn't Perl fire up a shell for any "system" which has a single
argument?)
-- 
	Paul Goldsmith	<goldfish@sbi.com>	      w	(212) 783-7733
	(shredding elf)	<goldfish@ozrout.uucp>	      h	(212) 727-9345
	( Shirley MacLaine told me there would be LIFETIMES like this)
		so many managers ... so little time ...

