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

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!melkur.dev.cdx.mot.com!mcook
  3. From: mcook@melkur.dev.cdx.mot.com (Michael Cook)
  4. Subject: Re: What's the difference between `command` and system('command')?
  5. Message-ID: <mcook.716146751@melkur.dev.cdx.mot.com>
  6. Sender: news@merlin.dev.cdx.mot.com (USENET News System)
  7. Nntp-Posting-Host: melkur.dev.cdx.mot.com
  8. Organization: Motorola Codex, Canton, Massachusetts
  9. References: <sasswb.716131013@k2>
  10. Date: Thu, 10 Sep 1992 17:39:11 GMT
  11. Lines: 25
  12.  
  13. sasswb@unx.sas.com (Scott Bass) writes:
  14.  
  15. >What the difference between saying `some Unix command` and system('some Unix
  16. >command')?  Are they synonymous?  Are there situations where one is better
  17. >than the other?
  18.  
  19. `foo` captures foo's output.  system('foo') doesn't.
  20.  
  21. To see the difference, try this:
  22.  
  23.     $foo = `echo foo`;
  24.     print "foo=($foo), exit=$?\n";
  25.     $bar = system('echo bar');
  26.     print "bar=($bar), exit=$?\n";
  27.  
  28. >Finally, what I need to do is export the DISPLAY variable from a PERL script
  29. >that's submitted via cron.  I was just going to give the "export
  30. >DISPLAY=value" (ksh) command.  If there is a better PERL way of doing it,
  31. >please let me know.
  32.  
  33. See %ENV in the manual:
  34.  
  35.  $ENV{'DISPLAY'} = 'foo:0.0';
  36.  
  37. Michael.
  38.