home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / perl / 7744 < prev    next >
Encoding:
Text File  |  1993-01-11  |  1.8 KB  |  43 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!wupost!csus.edu!netcom.com!jfh
  3. From: jfh@netcom.com (Jack Hamilton)
  4. Subject: Re: How to run a Perl under DOS?
  5. Message-ID: <1993Jan11.062312.323@netcom.com>
  6. Organization: Netcom - Online Communication Services (408 241-9760 guest)
  7. References: <1270@alsys1.aecom.yu.edu> <1993Jan8.220106.10383@netcom.com> <1272@alsys1.aecom.yu.edu>
  8. Date: Mon, 11 Jan 1993 06:23:12 GMT
  9. Lines: 32
  10.  
  11. In article <1272@alsys1.aecom.yu.edu> manaster@yu1.yu.edu (Chaim Manaster) 
  12. writes:
  13. >>>>1  >>    @rem = '                   
  14. >>>>2  >>    some dos batch commands
  15. >>>>3  >>    PERL -S %0.BAT %1 %2 %3 (etc)
  16. >>>>4  >>    GOTO ENDOFPERL
  17. >>>>5  >>    ';
  18. >>>>6  >>    # your perl script here
  19. >>>>7  >>    __END__
  20. >>>>8  >>    :ENDOFPERL
  21. >>>>9  >>    some more DOS if you need it
  22. >>>>10 >>    rem Drop through end of Batch file
  23. >
  24. >I am still very confised on this one. If my batch file is named
  25. >"howdy" and my DOS command line is: Howdy firstname lastname, then
  26. >firstname gets passed to %1 and lastname gets passed to %2. Then,
  27. >when Perl is activated it passes %1 and %2 to @ARGV. Where do the
  28. >single quotes youtalk about come into the picture? Also if  there
  29. >were no single quotes (no matter where they come from) would Perl
  30. >then do an expansion as well?
  31.  
  32. The quotes just make 1-5 a literal to perl.  When perl is called, it isn't
  33. called as "perl howdy.bat %1 %2", it's called as "perl howdy.bat firstname
  34. lastname" - the arguments have already been expanded by DOS.  If there were
  35. no quotes of any kind, the whole thing would blow up.  If there were double
  36. quotes, perl would (I think) try to interpret %1, etc as associative
  37. arrays.  It still works, but it seems to take a little longer. 
  38.  
  39. -- 
  40.  
  41. -----------------------------------------------------------------------
  42. Jack Hamilton   jfh@netcom.com   P. O. Box 281107   SF, CA   94128-1107
  43.