home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / perl / 5842 < prev    next >
Encoding:
Text File  |  1992-09-10  |  2.0 KB  |  51 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!convex!convex!tchrist
  3. From: Tom Christiansen <tchrist@convex.COM>
  4. Subject: Re: What's the difference between `command` and system('command')?
  5. Originator: tchrist@pixel.convex.com
  6. Sender: usenet@news.eng.convex.com (news access account)
  7. Message-ID: <1992Sep10.183530.21405@news.eng.convex.com>
  8. Date: Thu, 10 Sep 1992 18:35:30 GMT
  9. Reply-To: tchrist@convex.COM (Tom Christiansen)
  10. References: <sasswb.716131013@k2>
  11. Nntp-Posting-Host: pixel.convex.com
  12. Organization: Convex Computer Corporation, Colorado Springs, CO
  13. X-Disclaimer: This message was written by a user at CONVEX Computer
  14.               Corp. The opinions expressed are those of the user and
  15.               not necessarily those of CONVEX.
  16. Lines: 33
  17.  
  18. From the keyboard of sasswb@unx.sas.com (Scott Bass):
  19. :Sorry for the basic question, but I couldn't find this in the Camel book.
  20.  
  21.     It won't be covered in the book.  The source code has to be useful for
  22.     something, after all...  :-)
  23.             --Larry Wall in <10160@jpl-devvax.JPL.NASA.GOV>
  24.  
  25. :What the difference between saying `some Unix command` and
  26. :system('some Unix command')?  Are they synonymous?  Are there situations
  27. :where one is better than the other?
  28.  
  29.     `cmd`;
  30.     $line = `cmd`;
  31.     @lines = `cmd`;
  32.  
  33. returns the output, as it does in the shell.  The first form,
  34. however, throws it away.  system() works much (although not
  35. quite exactly) as it does in C.
  36.  
  37. :Finally, what I need to do is export the DISPLAY variable from a PERL
  38. :script that's submitted via cron.  I was just going to give the
  39. :"export DISPLAY=value" (ksh) command.  If there is a better PERL way of
  40. :doing it, please let me know.
  41.  
  42.     $ENV{DISPLAY} = $value;
  43.     system $cmd;
  44.  
  45. --tom
  46. -- 
  47.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  48. As the trials of life continue to take their toll, remember that there
  49. is always a future in Computer Maintenance.
  50.                 -- National Lampoon, "Deteriorada"
  51.