home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / perl / 7756 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  3.0 KB

  1. Path: sparky!uunet!psinntp!alsys1!yu1.yu.edu!manaster
  2. From: manaster@yu1.yu.edu (Chaim Manaster)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: How to run a Perl under DOS?
  5. Message-ID: <1278@alsys1.aecom.yu.edu>
  6. Date: 11 Jan 93 18:46:39 GMT
  7. References: <1993Jan8.220106.10383@netcom.com> <1272@alsys1.aecom.yu.edu> <1993Jan11.062312.323@netcom.com>
  8. Sender: news@alsys1.aecom.yu.edu
  9. Organization: School of Engineering and Applied Sciences, UCLA
  10. Lines: 61
  11. Nntp-Posting-Host: yu1.yu.edu
  12.  
  13. In article <1993Jan11.062312.323@netcom.com> jfh@netcom.com (Jack Hamilton) writes:
  14. >>>>>1  >>    @rem = '                   
  15. >>>>>2  >>    some dos batch commands
  16. >>>>>3  >>    PERL -S %0.BAT %1 %2 %3 (etc)
  17. >>>>>4  >>    GOTO ENDOFPERL
  18. >>>>>5  >>    ';
  19. >>>>>6  >>    # your perl script here
  20. >>>>>7  >>    __END__
  21. >>>>>8  >>    :ENDOFPERL
  22. >>>>>9  >>    some more DOS if you need it
  23. >>>>>10 >>    rem Drop through end of Batch file
  24. >>
  25. >>I am still very confised on this one. If my batch file is named
  26. >>"howdy" and my DOS command line is: Howdy firstname lastname, then
  27. >>firstname gets passed to %1 and lastname gets passed to %2. Then,
  28. >>when Perl is activated it passes %1 and %2 to @ARGV. Where do the
  29. >>single quotes youtalk about come into the picture? Also if  there
  30. >>were no single quotes (no matter where they come from) would Perl
  31. >>then do an expansion as well?
  32. >
  33. >The quotes just make 1-5 a literal to perl.  When perl is called, it isn't
  34. >called as "perl howdy.bat %1 %2", it's called as "perl howdy.bat firstname
  35. >lastname" - the arguments have already been expanded by DOS.  If there were
  36. >no quotes of any kind, the whole thing would blow up.  If there were double
  37. >quotes, perl would (I think) try to interpret %1, etc as associative
  38. >arrays.  It still works, but it seems to take a little longer. 
  39.  
  40. I still have problems understanding your response.
  41. As you say above, the DOS batch processor gets:
  42.     perl howdy.bat %1 %2
  43. and expands it to:
  44.     perl howdy.bat firstname lastname
  45. What I don't see is where either the single quotes or double quotes
  46. you refer to, come from. The only quotes in the script above,
  47. enclosing lines 1-5 (single quote) are used by perl once it has
  48. already been invoked and for all practile purposes thrown away.
  49. Teh line seen by the perl line as seen by the DOS processor has NO
  50. quotes (of either kind) at all. So the last three or four lines of
  51. your reply above still confuse me.
  52.  
  53. My original question was meant to be, if (for example) lastname was
  54. replaced by Henry$lastname would perl expand the $lastname part of
  55. the parameter, and would DOS either choke or expand it as well? And
  56. if you wanted to prevent expansion by either DOS or perl what would
  57. you do?
  58.  
  59. Thanks again.
  60.  
  61. Henry Manaster
  62.  
  63.  
  64.  
  65. -- 
  66. ***************************************************************************
  67.     Henry Manaster          *     EMail: manaster@yu1.yu.edu
  68.     Brooklyn, NY            *
  69.                                 *
  70.     Disclaimer: The above is not necessarily MY opinion nor that 
  71.                 of anyone else :-)  ????!
  72. ****************************************************************************
  73.  
  74.