home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!psinntp!alsys1!yu1.yu.edu!manaster
- 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 :-) ????!
- ****************************************************************************
-
-