home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!wupost!csus.edu!netcom.com!jfh
- 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
-